@osdk/faux 0.48.0 → 0.49.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 +12 -0
- package/build/browser/FauxFoundry/FauxOntology.js +2 -0
- package/build/browser/FauxFoundry/FauxOntology.js.map +1 -1
- package/build/browser/FauxFoundry/validateAction.js +1 -0
- package/build/browser/FauxFoundry/validateAction.js.map +1 -1
- package/build/cjs/index.cjs +22 -19
- package/build/cjs/index.cjs.map +1 -1
- package/build/esm/FauxFoundry/FauxOntology.js +2 -0
- package/build/esm/FauxFoundry/FauxOntology.js.map +1 -1
- package/build/esm/FauxFoundry/validateAction.js +1 -0
- package/build/esm/FauxFoundry/validateAction.js.map +1 -1
- package/build/types/FauxFoundry/FauxOntology.d.ts.map +1 -1
- package/build/types/FauxFoundry/validateAction.d.ts.map +1 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @osdk/shared.test
|
|
2
2
|
|
|
3
|
+
## 0.49.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- e3a381d: Bump the `@osdk/foundry.*` and `@osdk/internal.foundry.*` catalog entries to `2.77.0`. Generated experimental ontology metadata now includes full action type metadata and logic rules.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [e3a381d]
|
|
12
|
+
- @osdk/api@2.65.0
|
|
13
|
+
- @osdk/generator-converters@2.65.0
|
|
14
|
+
|
|
3
15
|
## 0.48.0
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -30,6 +30,7 @@ export class FauxOntology {
|
|
|
30
30
|
constructor(ontology) {
|
|
31
31
|
this.#ontology = {
|
|
32
32
|
actionTypes: {},
|
|
33
|
+
actionTypesFullMetadata: {},
|
|
33
34
|
interfaceTypes: {},
|
|
34
35
|
objectTypes: {},
|
|
35
36
|
ontology,
|
|
@@ -52,6 +53,7 @@ export class FauxOntology {
|
|
|
52
53
|
linkTypes: objectTypeDefinition.linkTypes.filter(linkType => request.linkTypes.includes(linkType.apiName))
|
|
53
54
|
}])),
|
|
54
55
|
actionTypes: filterRecord(this.#ontology.actionTypes, request.actionTypes),
|
|
56
|
+
actionTypesFullMetadata: {},
|
|
55
57
|
queryTypes: this.#getFilteredQueryTypes(request),
|
|
56
58
|
interfaceTypes: filterRecord(this.#ontology.interfaceTypes, request.interfaceTypes),
|
|
57
59
|
sharedPropertyTypes: {},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FauxOntology.js","names":["semver","valid","invariant","ActionNotFoundError","LinkTypeNotFound","ObjectNotFoundError","ObjectTypeDoesNotExistError","QueryNotFoundError","camelize","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\";\n\nimport {\n ActionNotFoundError,\n LinkTypeNotFound,\n ObjectNotFoundError,\n ObjectTypeDoesNotExistError,\n QueryNotFoundError,\n} from \"../errors.js\";\nimport { camelize } from \"../handlers/util/camelize.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)\n .filter(([objectType]) => 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(404, ObjectNotFoundError(interfaceType, \"\"));\n }\n\n return this.#ontology.interfaceTypes[interfaceType];\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[camelize(actionTypeApiName)];\n if (actionType === undefined) {\n throw new OpenApiCallError(404, ActionNotFoundError());\n }\n return actionType;\n }\n\n public getActionImpl(actionTypeApiName: string): FauxActionImpl {\n const impl = this.#actionImpl.get(camelize(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 =\n this.#ontology.queryTypes[\n this.#convertToVersionedApiName(queryTypeApiNameAndVersion)\n ];\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 =\n version !== undefined\n ? versionMap?.get(version)\n : versionMap?.get(semver.rsort(Array.from(versionMap.keys() ?? []))[0]);\n\n if (!impl) {\n throw new OpenApiCallError(404, QueryNotFoundError(queryTypeApiName));\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 (const [ifaceApiName, { properties }] of Object.entries(\n objDef.implementsInterfaces2,\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(\n (a) => 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(\n (l) => 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(\n (l) => l.apiName !== thisSideLink.apiName,\n );\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(leftObjectType, leftLinkName);\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: TH_ObjectTypeFullMetadata<Q> | 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(`ActionType ${def.apiName} already registered`);\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(`QueryType ${def.apiName} already registered`);\n }\n this.#ontology.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(def.version, implementation);\n }\n }\n\n registerInterfaceType(def: OntologiesV2.InterfaceType): void {\n if (def.apiName in this.#ontology.interfaceTypes) {\n throw new Error(`InterfaceType ${def.apiName} already registered`);\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(`SharedPropertyType ${def.apiName} already registered`);\n }\n this.#ontology.sharedPropertyTypes[def.apiName] = def;\n }\n\n #getFilteredQueryTypes(\n request: LoadOntologyMetadataRequest,\n ): Record<OntologiesV2.QueryApiName, OntologiesV2.QueryTypeV2> {\n const remappedQueryTypes = request.queryTypes.map((x) =>\n this.#convertToVersionedApiName(x),\n );\n return Object.fromEntries(\n Object.entries(this.#ontology.queryTypes)\n .filter(([queryTypeApiName]) =>\n remappedQueryTypes.includes(queryTypeApiName),\n )\n .map(([queryTypeApiName, queryTypeDefinition]) => [\n request.queryTypes[remappedQueryTypes.indexOf(queryTypeApiName)],\n queryTypeDefinition,\n ]),\n );\n }\n\n #convertToVersionedApiName(apiName: string): 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)\n .filter(\n (queryTypeApiName) => queryTypeApiName.split(\":\")[0] === apiName,\n )\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(apiName: string): 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;AAGtC,SACEC,mBAAmB,EACnBC,gBAAgB,EAChBC,mBAAmB,EACnBC,2BAA2B,EAC3BC,kBAAkB,QACb,cAAc;AACrB,SAASC,QAAQ,QAAQ,8BAA8B;AACvD,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;EAEbE,WAAWA,CAACJ,QAAiC,EAAE;IAC7C,IAAI,CAAC,CAACA,QAAQ,GAAG;MACfK,WAAW,EAAE,CAAC,CAAC;MACfC,cAAc,EAAE,CAAC,CAAC;MAClBC,WAAW,EAAE,CAAC,CAAC;MACfP,QAAQ;MACRQ,UAAU,EAAE,CAAC,CAAC;MACdC,mBAAmB,EAAE,CAAC,CAAC;MACvBC,UAAU,EAAE,CAAC;IACf,CAAC;EACH;EAEA,IAAIC,OAAOA,CAAA,EAAiC;IAC1C,OAAO,IAAI,CAAC,CAACX,QAAQ,CAACA,QAAQ,CAACW,OAAO;EACxC;EAEAC,uBAAuBA,CAAA,EAAsC;IAC3D,OAAO,IAAI,CAAC,CAACZ,QAAQ;EACvB;EAEAa,2BAA2BA,CACzBC,OAAiD,EACd;IACnC,OAAO;MACLd,QAAQ,EAAE,IAAI,CAAC,CAACA,QAAQ,CAACA,QAAQ;MACjCO,WAAW,EAAEQ,MAAM,CAACC,WAAW,CAC7BD,MA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AAG,CAAC,CAAC,CAAC,CAAC;AAC9B","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"FauxOntology.js","names":["semver","valid","invariant","ActionNotFoundError","LinkTypeNotFound","ObjectNotFoundError","ObjectTypeDoesNotExistError","QueryNotFoundError","camelize","OpenApiCallError","FauxOntology","ontology","actionImpl","Map","queryImpl","constructor","actionTypes","actionTypesFullMetadata","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\";\n\nimport {\n ActionNotFoundError,\n LinkTypeNotFound,\n ObjectNotFoundError,\n ObjectTypeDoesNotExistError,\n QueryNotFoundError,\n} from \"../errors.js\";\nimport { camelize } from \"../handlers/util/camelize.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 actionTypesFullMetadata: {},\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)\n .filter(([objectType]) => 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 actionTypesFullMetadata: {},\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(404, ObjectNotFoundError(interfaceType, \"\"));\n }\n\n return this.#ontology.interfaceTypes[interfaceType];\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[camelize(actionTypeApiName)];\n if (actionType === undefined) {\n throw new OpenApiCallError(404, ActionNotFoundError());\n }\n return actionType;\n }\n\n public getActionImpl(actionTypeApiName: string): FauxActionImpl {\n const impl = this.#actionImpl.get(camelize(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 =\n this.#ontology.queryTypes[\n this.#convertToVersionedApiName(queryTypeApiNameAndVersion)\n ];\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 =\n version !== undefined\n ? versionMap?.get(version)\n : versionMap?.get(semver.rsort(Array.from(versionMap.keys() ?? []))[0]);\n\n if (!impl) {\n throw new OpenApiCallError(404, QueryNotFoundError(queryTypeApiName));\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 (const [ifaceApiName, { properties }] of Object.entries(\n objDef.implementsInterfaces2,\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(\n (a) => 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(\n (l) => 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(\n (l) => l.apiName !== thisSideLink.apiName,\n );\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(leftObjectType, leftLinkName);\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: TH_ObjectTypeFullMetadata<Q> | 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(`ActionType ${def.apiName} already registered`);\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(`QueryType ${def.apiName} already registered`);\n }\n this.#ontology.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(def.version, implementation);\n }\n }\n\n registerInterfaceType(def: OntologiesV2.InterfaceType): void {\n if (def.apiName in this.#ontology.interfaceTypes) {\n throw new Error(`InterfaceType ${def.apiName} already registered`);\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(`SharedPropertyType ${def.apiName} already registered`);\n }\n this.#ontology.sharedPropertyTypes[def.apiName] = def;\n }\n\n #getFilteredQueryTypes(\n request: LoadOntologyMetadataRequest,\n ): Record<OntologiesV2.QueryApiName, OntologiesV2.QueryTypeV2> {\n const remappedQueryTypes = request.queryTypes.map((x) =>\n this.#convertToVersionedApiName(x),\n );\n return Object.fromEntries(\n Object.entries(this.#ontology.queryTypes)\n .filter(([queryTypeApiName]) =>\n remappedQueryTypes.includes(queryTypeApiName),\n )\n .map(([queryTypeApiName, queryTypeDefinition]) => [\n request.queryTypes[remappedQueryTypes.indexOf(queryTypeApiName)],\n queryTypeDefinition,\n ]),\n );\n }\n\n #convertToVersionedApiName(apiName: string): 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)\n .filter(\n (queryTypeApiName) => queryTypeApiName.split(\":\")[0] === apiName,\n )\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(apiName: string): 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,M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,CAC9C,CAAC,CACAhC,GAAG,CAAC,CAAC,CAACgC,gBAAgB,EAAE8C,mBAAmB,CAAC,KAAK,CAChDrF,OAAO,CAACN,UAAU,CAACyF,kBAAkB,CAACG,OAAO,CAAC/C,gBAAgB,CAAC,CAAC,EAChE8C,mBAAmB,CACpB,CACL,CAAC;EACH;EAEA,CAAChD,yBAAyBkD,CAAC1F,OAAe,EAA6B;IACrE;IACA,IAAI2F,cAAc,CAAC3F,OAAO,CAAC,KAAKyB,SAAS,EAAE;MACzC,OAAOzB,OAAO;IAChB;IACA,MAAM2C,OAAO,GAAGlE,MAAM,CAACoE,KAAK,CAC1BzC,MAAM,CAAC4C,IAAI,CAAC,IAAI,CAAC,CAAC5D,QAAQ,CAACS,UAAU,CAAC,CACnCU,MAAM,CACJmC,gBAAgB,IAAKA,gBAAgB,CAACkD,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK5F,OAC3D,CAAC,CACAU,GAAG,CAAE6E,CAAC,IAAKI,cAAc,CAACJ,CAAC,CAAC,CACjC,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,CAAC3F,OAAe,EAAU;EAC/C,OAAOA,OAAO,CAAC4F,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC9B","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateAction.js","names":["NUMERIC_LITERAL_BOUNDS","byte","minimum","maximum","double","Number","MAX_VALUE","float","integer","long","MIN_SAFE_INTEGER","MAX_SAFE_INTEGER","short","validateAction","payload","def","dataStore","ret","parameters","submissionCriteria","result","k","v","Object","entries","value","validateActionParameterType","dataType","paramDef","paramKey","required","evaluatedConstraints","baseParam","type","Array","isArray","item","subType","matchesOntologyDataType","isInterfaceActionParam","getObject","objectTypeApiName","primaryKeyValue","isMediaReference","name","fieldType","fields","fieldValue","ontology","getObjectTypeFullMetadata","scenarioRid","Error","odt","every","itemType","isInBounds","isValidCipherText","isValidDateString","isValidDecimalString","isInteger","startsWith","isValidTimestampString","o","mimeType","reference","mediaSetViewItem","mediaSetRid","mediaSetViewRid","mediaItemRid","isPoint","obj","coordinates","length","bounds","test","date","Date","isNaN","getTime","toISOString","parts","split","isValidCipherAffix","channelRid","encryptedValue","affix","prefixOnly","totalParts","parseFloat"],"sources":["validateAction.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { MediaReference } from \"@osdk/foundry.core\";\nimport type {\n ActionParameterType,\n ActionParameterV2,\n ActionTypeV2,\n ApplyActionRequestV2,\n BatchApplyActionRequestItem,\n OntologyDataType,\n ParameterEvaluationResult,\n ValidateActionResponseV2,\n} from \"@osdk/foundry.ontologies\";\n\nimport type { FauxDataStore } from \"./FauxDataStore.js\";\n\ninterface Bounds {\n minimum: number;\n maximum: number;\n}\n\nconst NUMERIC_LITERAL_BOUNDS: Record<\n Extract<\n OntologyDataType[\"type\"],\n \"double\" | \"integer\" | \"long\" | \"float\" | \"byte\" | \"short\"\n >,\n Bounds\n> = {\n byte: {\n // Java min/max byte bounds\n minimum: -128,\n maximum: 127,\n },\n double: {\n // These numbers are smaller than the actual min/max of a java double,\n // but going higher will require using BigInt in our input fields.\n minimum: -Number.MAX_VALUE,\n maximum: Number.MAX_VALUE,\n },\n float: {\n // Java min/max float bounds\n minimum: -3.4028235e38,\n maximum: 3.4028235e38,\n },\n integer: {\n // Java min/max integer bounds\n minimum: -2147483648,\n maximum: 2147483647,\n },\n long: {\n // These numbers are smaller than the actual min/max of a java long,\n // but going higher will require using BigInt in our input fields.\n minimum: Number.MIN_SAFE_INTEGER,\n maximum: Number.MAX_SAFE_INTEGER,\n },\n short: {\n // Java min/max short bounds\n minimum: -32768,\n maximum: 32767,\n },\n} as const;\n\nexport function validateAction(\n payload: ApplyActionRequestV2 | BatchApplyActionRequestItem,\n def: ActionTypeV2,\n dataStore: FauxDataStore,\n): ValidateActionResponseV2 {\n const ret: ValidateActionResponseV2 = {\n parameters: {},\n submissionCriteria: [],\n result: \"VALID\",\n };\n for (const [k, v] of Object.entries(def.parameters)) {\n const value = payload.parameters[k];\n validateActionParameterType(v.dataType, v, value, ret, k, dataStore);\n }\n\n return ret;\n}\n\n// So far these all basically return the same thing\n// and can likely be rewritten as a function that return boolean\nfunction validateActionParameterType(\n dataType: ActionParameterType,\n paramDef: ActionParameterV2,\n value: unknown,\n ret: ValidateActionResponseV2,\n paramKey: string,\n dataStore: FauxDataStore,\n) {\n if (paramDef.required && value == null) {\n ret.result = \"INVALID\";\n ret.parameters[paramKey] = {\n result: \"INVALID\",\n evaluatedConstraints: [],\n required: true,\n };\n return;\n }\n if (!paramDef.required && value == null) {\n return;\n }\n\n const baseParam: ParameterEvaluationResult = {\n result: \"INVALID\",\n evaluatedConstraints: [],\n required: paramDef.required,\n };\n\n switch (dataType.type) {\n case \"array\": {\n if (!Array.isArray(value)) {\n ret.result = \"INVALID\";\n ret.parameters[paramKey] = {\n ...baseParam,\n };\n return;\n }\n for (const item of value) {\n validateActionParameterType(\n dataType.subType,\n paramDef,\n item,\n ret,\n paramKey,\n dataStore,\n );\n }\n return;\n }\n\n case \"attachment\": {\n if (typeof value !== \"string\") {\n ret.result = \"INVALID\";\n ret.parameters[paramKey] = {\n ...baseParam,\n };\n }\n return;\n }\n\n case \"boolean\":\n case \"date\":\n case \"long\":\n case \"double\":\n case \"integer\":\n case \"marking\":\n case \"objectSet\":\n case \"timestamp\":\n case \"object\":\n case \"string\":\n if (!matchesOntologyDataType(dataType, value)) {\n ret.result = \"INVALID\";\n ret.parameters[paramKey] = {\n ...baseParam,\n };\n }\n return;\n case \"geohash\":\n if (\n !(\n typeof value === \"string\" ||\n (typeof value === \"object\" && value != null && \"coordinates\" in value)\n )\n ) {\n ret.result = \"INVALID\";\n ret.parameters[paramKey] = {\n ...baseParam,\n };\n }\n return;\n\n case \"geoshape\":\n if (\n !(\n typeof value === \"object\" &&\n (\"coordinates\" in value! ||\n \"geometries\" in value! ||\n \"features\" in value!)\n )\n ) {\n ret.result = \"INVALID\";\n ret.parameters[paramKey] = {\n ...baseParam,\n };\n }\n return;\n case \"interfaceObject\": {\n if (!isInterfaceActionParam(value)) {\n ret.result = \"INVALID\";\n ret.parameters[paramKey] = {\n ...baseParam,\n };\n } else if (\n dataStore.getObject(value.objectTypeApiName, value.primaryKeyValue) ==\n null\n ) {\n ret.result = \"INVALID\";\n ret.parameters[paramKey] = {\n ...baseParam,\n evaluatedConstraints: [\n {\n type: \"objectPropertyValue\",\n },\n ],\n };\n }\n return;\n }\n\n case \"mediaReference\": {\n if (!isMediaReference(value)) {\n ret.result = \"INVALID\";\n ret.parameters[paramKey] = {\n ...baseParam,\n };\n }\n return;\n }\n\n case \"vector\": {\n ret.result = \"INVALID\";\n ret.parameters[paramKey] = {\n ...baseParam,\n };\n return;\n }\n\n case \"struct\": {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n ret.result = \"INVALID\";\n ret.parameters[paramKey] = {\n ...baseParam,\n };\n return;\n }\n\n for (const { name, fieldType, required } of dataType.fields) {\n const fieldValue = (value as Record<string, unknown>)[name];\n // A non-required field may be omitted or explicitly null; only run the\n // type check when a value is actually present.\n if (fieldValue == null) {\n if (required) {\n ret.result = \"INVALID\";\n ret.parameters[paramKey] = {\n ...baseParam,\n };\n return;\n }\n continue;\n }\n if (!matchesOntologyDataType(fieldType, fieldValue)) {\n ret.result = \"INVALID\";\n ret.parameters[paramKey] = {\n ...baseParam,\n };\n\n return;\n }\n }\n\n return;\n }\n\n case \"objectType\": {\n if (\n typeof value !== \"string\" ||\n !dataStore.ontology.getObjectTypeFullMetadata(value)\n ) {\n ret.result = \"INVALID\";\n ret.parameters[paramKey] = {\n ...baseParam,\n };\n return;\n }\n\n return;\n }\n\n case \"scenarioReference\": {\n if (\n !value ||\n typeof value !== \"object\" ||\n typeof (value as { scenarioRid?: unknown }).scenarioRid !== \"string\"\n ) {\n ret.result = \"INVALID\";\n ret.parameters[paramKey] = {\n ...baseParam,\n };\n }\n return;\n }\n\n default: {\n const _assertNever: never = dataType;\n throw new Error(`validateDataType: unknown type`);\n }\n }\n}\n\nexport function matchesOntologyDataType(\n odt: OntologyDataType,\n value: unknown,\n): boolean {\n switch (odt.type) {\n case \"any\":\n return true;\n case \"array\":\n return (\n Array.isArray(value) &&\n value.every((v) => matchesOntologyDataType(odt.itemType, v))\n );\n case \"binary\":\n throw new Error(`validateDataType: ${odt.type} not implemented yet.`);\n case \"boolean\":\n return typeof value === \"boolean\";\n case \"byte\":\n return (\n typeof value === \"number\" &&\n isInBounds(value, NUMERIC_LITERAL_BOUNDS.byte)\n );\n case \"cipherText\":\n return isValidCipherText(value);\n case \"date\":\n return isValidDateString(value);\n case \"decimal\":\n return isValidDecimalString(value);\n case \"double\":\n return (\n typeof value === \"number\" &&\n isInBounds(value, NUMERIC_LITERAL_BOUNDS.double)\n );\n case \"float\":\n return (\n typeof value === \"number\" &&\n isInBounds(value, NUMERIC_LITERAL_BOUNDS.float)\n );\n case \"integer\":\n return (\n typeof value === \"number\" &&\n Number.isInteger(value) &&\n isInBounds(value, NUMERIC_LITERAL_BOUNDS.integer)\n );\n case \"long\":\n return (\n typeof value === \"number\" &&\n Number.isInteger(value) &&\n isInBounds(value, NUMERIC_LITERAL_BOUNDS.long)\n );\n case \"map\":\n throw new Error(\n `matchesOntologyDataType: ${odt.type} not implemented yet.`,\n );\n case \"marking\":\n return typeof value === \"string\";\n case \"object\":\n return (\n typeof value === \"string\" ||\n (value != null && typeof value === \"object\" && \"$primaryKey\" in value)\n );\n case \"objectSet\":\n return (\n (typeof value === \"string\" && value.startsWith(\"ri.\")) ||\n (value != null && typeof value === \"object\" && \"objectSet\" in value)\n );\n case \"set\":\n throw new Error(\n `matchesOntologyDataType: ${odt.type} not implemented yet.`,\n );\n case \"short\":\n return (\n typeof value === \"number\" &&\n isInBounds(value, NUMERIC_LITERAL_BOUNDS.short)\n );\n case \"string\":\n return typeof value === \"string\";\n case \"struct\":\n throw new Error(\n `matchesOntologyDataType: ${odt.type} not implemented yet.`,\n );\n case \"timestamp\":\n return isValidTimestampString(value);\n case \"unsupported\":\n throw new Error(\n `matchesOntologyDataType: ${odt.type} not implemented yet.`,\n );\n default:\n const _assertNever = odt;\n throw new Error(\n `matchesOntologyDataType: ${(odt as any).type} not implemented yet.`,\n );\n }\n}\n\nexport function isMediaReference(o: any): o is MediaReference {\n return (\n typeof o === `object` &&\n typeof o.mimeType === \"string\" &&\n \"reference\" in o &&\n typeof o.reference === \"object\" &&\n o.reference.type === \"mediaSetViewItem\" &&\n \"mediaSetViewItem\" in o.reference &&\n typeof o.reference.mediaSetViewItem === \"object\" &&\n typeof o.reference.mediaSetViewItem.mediaSetRid === \"string\" &&\n typeof o.reference.mediaSetViewItem.mediaSetViewRid === \"string\" &&\n typeof o.reference.mediaSetViewItem.mediaItemRid === \"string\"\n );\n}\n\nexport function isInterfaceActionParam(value: any): value is {\n objectTypeApiName: string;\n primaryKeyValue: string | number | boolean;\n} {\n return (\n typeof value === \"object\" &&\n \"objectTypeApiName\" in value &&\n typeof value.objectTypeApiName === \"string\" &&\n \"primaryKeyValue\" in value &&\n (typeof value.primaryKeyValue === \"string\" ||\n typeof value.primaryKeyValue === \"number\" ||\n typeof value.primaryKeyValue === \"boolean\")\n );\n}\n\nfunction isPoint(obj: any): obj is GeoJSON.Point {\n return (\n obj.type === \"Point\" &&\n Array.isArray(obj.coordinates) &&\n obj.coordinates.length === 2 &&\n typeof obj.coordinates[0] === \"number\" &&\n typeof obj.coordinates[1] === \"number\"\n );\n}\n\nfunction isInBounds(\n value: number,\n bounds: { minimum: number; maximum: number },\n) {\n return bounds.minimum <= value && value <= bounds.maximum;\n}\n\nfunction isValidDateString(value: unknown): boolean {\n if (typeof value !== \"string\") {\n return false;\n }\n\n const dateRegex = /^\\d{4}-\\d{2}-\\d{2}$/u;\n if (!dateRegex.test(value)) {\n return false;\n }\n const date = new Date(value);\n return !isNaN(date.getTime()) && date.toISOString().startsWith(value);\n}\n\nfunction isValidTimestampString(value: unknown): boolean {\n return typeof value === \"string\" && !isNaN(new Date(value).getTime());\n}\n\nfunction isValidCipherText(value: unknown): boolean {\n if (typeof value !== \"string\") {\n return false;\n }\n\n const parts = value.split(\"::\");\n\n if (\n !(\n isValidCipherAffix(parts, \"CIPHER\") ||\n isValidCipherAffix(parts, \"BELLASO\") ||\n isValidCipherAffix(parts, \"BELLASO\", true)\n )\n ) {\n return false;\n }\n\n const channelRid = parts[1];\n const encryptedValue = parts[2];\n\n return channelRid.startsWith(\"ri.\") && encryptedValue !== \"\";\n}\n\nfunction isValidCipherAffix(\n parts: string[],\n affix: \"BELLASO\" | \"CIPHER\",\n prefixOnly: boolean = false,\n): boolean {\n const totalParts = prefixOnly ? 3 : 4;\n\n return (\n parts.length === totalParts &&\n parts[0] === affix &&\n (prefixOnly || parts[3] === affix)\n );\n}\n\nfunction isValidDecimalString(value: unknown): boolean {\n if (typeof value !== \"string\") {\n return false;\n }\n\n const decimalRegex = /^[+-]?(\\d+\\.?\\d*|\\.\\d+)(E[+-]?\\d+)?$/u;\n return decimalRegex.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OUNDS","byte","minimum","maximum","double","Number","MAX_VALUE","float","integer","long","MIN_SAFE_INTEGER","MAX_SAFE_INTEGER","short","validateAction","payload","def","dataStore","ret","parameters","submissionCriteria","result","k","v","Object","entries","value","validateActionParameterType","dataType","paramDef","paramKey","required","evaluatedConstraints","baseParam","type","Array","isArray","item","subType","matchesOntologyDataType","isInterfaceActionParam","getObject","objectTypeApiName","primaryKeyValue","isMediaReference","name","fieldType","fields","fieldValue","ontology","getObjectTypeFullMetadata","scenarioRid","Error","odt","every","itemType","isInBounds","isValidCipherText","isValidDateString","isValidDecimalString","isInteger","startsWith","isValidTimestampString","o","mimeType","reference","mediaSetViewItem","mediaSetRid","mediaSetViewRid","mediaItemRid","isPoint","obj","coordinates","length","bounds","test","date","Date","isNaN","getTime","toISOString","parts","split","isValidCipherAffix","channelRid","encryptedValue","affix","prefixOnly","totalParts","parseFloat"],"sources":["validateAction.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { MediaReference } from \"@osdk/foundry.core\";\nimport type {\n ActionParameterType,\n ActionParameterV2,\n ActionTypeV2,\n ApplyActionRequestV2,\n BatchApplyActionRequestItem,\n OntologyDataType,\n ParameterEvaluationResult,\n ValidateActionResponseV2,\n} from \"@osdk/foundry.ontologies\";\n\nimport type { FauxDataStore } from \"./FauxDataStore.js\";\n\ninterface Bounds {\n minimum: number;\n maximum: number;\n}\n\nconst NUMERIC_LITERAL_BOUNDS: Record<\n Extract<\n OntologyDataType[\"type\"],\n \"double\" | \"integer\" | \"long\" | \"float\" | \"byte\" | \"short\"\n >,\n Bounds\n> = {\n byte: {\n // Java min/max byte bounds\n minimum: -128,\n maximum: 127,\n },\n double: {\n // These numbers are smaller than the actual min/max of a java double,\n // but going higher will require using BigInt in our input fields.\n minimum: -Number.MAX_VALUE,\n maximum: Number.MAX_VALUE,\n },\n float: {\n // Java min/max float bounds\n minimum: -3.4028235e38,\n maximum: 3.4028235e38,\n },\n integer: {\n // Java min/max integer bounds\n minimum: -2147483648,\n maximum: 2147483647,\n },\n long: {\n // These numbers are smaller than the actual min/max of a java long,\n // but going higher will require using BigInt in our input fields.\n minimum: Number.MIN_SAFE_INTEGER,\n maximum: Number.MAX_SAFE_INTEGER,\n },\n short: {\n // Java min/max short bounds\n minimum: -32768,\n maximum: 32767,\n },\n} as const;\n\nexport function validateAction(\n payload: ApplyActionRequestV2 | BatchApplyActionRequestItem,\n def: ActionTypeV2,\n dataStore: FauxDataStore,\n): ValidateActionResponseV2 {\n const ret: ValidateActionResponseV2 = {\n parameters: {},\n submissionCriteria: [],\n result: \"VALID\",\n };\n for (const [k, v] of Object.entries(def.parameters)) {\n const value = payload.parameters[k];\n validateActionParameterType(v.dataType, v, value, ret, k, dataStore);\n }\n\n return ret;\n}\n\n// So far these all basically return the same thing\n// and can likely be rewritten as a function that return boolean\nfunction validateActionParameterType(\n dataType: ActionParameterType,\n paramDef: ActionParameterV2,\n value: unknown,\n ret: ValidateActionResponseV2,\n paramKey: string,\n dataStore: FauxDataStore,\n) {\n if (paramDef.required && value == null) {\n ret.result = \"INVALID\";\n ret.parameters[paramKey] = {\n result: \"INVALID\",\n evaluatedConstraints: [],\n required: true,\n };\n return;\n }\n if (!paramDef.required && value == null) {\n return;\n }\n\n const baseParam: ParameterEvaluationResult = {\n result: \"INVALID\",\n evaluatedConstraints: [],\n required: paramDef.required,\n };\n\n switch (dataType.type) {\n case \"array\": {\n if (!Array.isArray(value)) {\n ret.result = \"INVALID\";\n ret.parameters[paramKey] = {\n ...baseParam,\n };\n return;\n }\n for (const item of value) {\n validateActionParameterType(\n dataType.subType,\n paramDef,\n item,\n ret,\n paramKey,\n dataStore,\n );\n }\n return;\n }\n\n case \"attachment\": {\n if (typeof value !== \"string\") {\n ret.result = \"INVALID\";\n ret.parameters[paramKey] = {\n ...baseParam,\n };\n }\n return;\n }\n\n case \"boolean\":\n case \"date\":\n case \"decimal\":\n case \"long\":\n case \"double\":\n case \"integer\":\n case \"marking\":\n case \"objectSet\":\n case \"timestamp\":\n case \"object\":\n case \"string\":\n if (!matchesOntologyDataType(dataType, value)) {\n ret.result = \"INVALID\";\n ret.parameters[paramKey] = {\n ...baseParam,\n };\n }\n return;\n case \"geohash\":\n if (\n !(\n typeof value === \"string\" ||\n (typeof value === \"object\" && value != null && \"coordinates\" in value)\n )\n ) {\n ret.result = \"INVALID\";\n ret.parameters[paramKey] = {\n ...baseParam,\n };\n }\n return;\n\n case \"geoshape\":\n if (\n !(\n typeof value === \"object\" &&\n (\"coordinates\" in value! ||\n \"geometries\" in value! ||\n \"features\" in value!)\n )\n ) {\n ret.result = \"INVALID\";\n ret.parameters[paramKey] = {\n ...baseParam,\n };\n }\n return;\n case \"interfaceObject\": {\n if (!isInterfaceActionParam(value)) {\n ret.result = \"INVALID\";\n ret.parameters[paramKey] = {\n ...baseParam,\n };\n } else if (\n dataStore.getObject(value.objectTypeApiName, value.primaryKeyValue) ==\n null\n ) {\n ret.result = \"INVALID\";\n ret.parameters[paramKey] = {\n ...baseParam,\n evaluatedConstraints: [\n {\n type: \"objectPropertyValue\",\n },\n ],\n };\n }\n return;\n }\n\n case \"mediaReference\": {\n if (!isMediaReference(value)) {\n ret.result = \"INVALID\";\n ret.parameters[paramKey] = {\n ...baseParam,\n };\n }\n return;\n }\n\n case \"vector\": {\n ret.result = \"INVALID\";\n ret.parameters[paramKey] = {\n ...baseParam,\n };\n return;\n }\n\n case \"struct\": {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n ret.result = \"INVALID\";\n ret.parameters[paramKey] = {\n ...baseParam,\n };\n return;\n }\n\n for (const { name, fieldType, required } of dataType.fields) {\n const fieldValue = (value as Record<string, unknown>)[name];\n // A non-required field may be omitted or explicitly null; only run the\n // type check when a value is actually present.\n if (fieldValue == null) {\n if (required) {\n ret.result = \"INVALID\";\n ret.parameters[paramKey] = {\n ...baseParam,\n };\n return;\n }\n continue;\n }\n if (!matchesOntologyDataType(fieldType, fieldValue)) {\n ret.result = \"INVALID\";\n ret.parameters[paramKey] = {\n ...baseParam,\n };\n\n return;\n }\n }\n\n return;\n }\n\n case \"objectType\": {\n if (\n typeof value !== \"string\" ||\n !dataStore.ontology.getObjectTypeFullMetadata(value)\n ) {\n ret.result = \"INVALID\";\n ret.parameters[paramKey] = {\n ...baseParam,\n };\n return;\n }\n\n return;\n }\n\n case \"scenarioReference\": {\n if (\n !value ||\n typeof value !== \"object\" ||\n typeof (value as { scenarioRid?: unknown }).scenarioRid !== \"string\"\n ) {\n ret.result = \"INVALID\";\n ret.parameters[paramKey] = {\n ...baseParam,\n };\n }\n return;\n }\n\n default: {\n const _assertNever: never = dataType;\n throw new Error(`validateDataType: unknown type`);\n }\n }\n}\n\nexport function matchesOntologyDataType(\n odt: OntologyDataType,\n value: unknown,\n): boolean {\n switch (odt.type) {\n case \"any\":\n return true;\n case \"array\":\n return (\n Array.isArray(value) &&\n value.every((v) => matchesOntologyDataType(odt.itemType, v))\n );\n case \"binary\":\n throw new Error(`validateDataType: ${odt.type} not implemented yet.`);\n case \"boolean\":\n return typeof value === \"boolean\";\n case \"byte\":\n return (\n typeof value === \"number\" &&\n isInBounds(value, NUMERIC_LITERAL_BOUNDS.byte)\n );\n case \"cipherText\":\n return isValidCipherText(value);\n case \"date\":\n return isValidDateString(value);\n case \"decimal\":\n return isValidDecimalString(value);\n case \"double\":\n return (\n typeof value === \"number\" &&\n isInBounds(value, NUMERIC_LITERAL_BOUNDS.double)\n );\n case \"float\":\n return (\n typeof value === \"number\" &&\n isInBounds(value, NUMERIC_LITERAL_BOUNDS.float)\n );\n case \"integer\":\n return (\n typeof value === \"number\" &&\n Number.isInteger(value) &&\n isInBounds(value, NUMERIC_LITERAL_BOUNDS.integer)\n );\n case \"long\":\n return (\n typeof value === \"number\" &&\n Number.isInteger(value) &&\n isInBounds(value, NUMERIC_LITERAL_BOUNDS.long)\n );\n case \"map\":\n throw new Error(\n `matchesOntologyDataType: ${odt.type} not implemented yet.`,\n );\n case \"marking\":\n return typeof value === \"string\";\n case \"object\":\n return (\n typeof value === \"string\" ||\n (value != null && typeof value === \"object\" && \"$primaryKey\" in value)\n );\n case \"objectSet\":\n return (\n (typeof value === \"string\" && value.startsWith(\"ri.\")) ||\n (value != null && typeof value === \"object\" && \"objectSet\" in value)\n );\n case \"set\":\n throw new Error(\n `matchesOntologyDataType: ${odt.type} not implemented yet.`,\n );\n case \"short\":\n return (\n typeof value === \"number\" &&\n isInBounds(value, NUMERIC_LITERAL_BOUNDS.short)\n );\n case \"string\":\n return typeof value === \"string\";\n case \"struct\":\n throw new Error(\n `matchesOntologyDataType: ${odt.type} not implemented yet.`,\n );\n case \"timestamp\":\n return isValidTimestampString(value);\n case \"unsupported\":\n throw new Error(\n `matchesOntologyDataType: ${odt.type} not implemented yet.`,\n );\n default:\n const _assertNever = odt;\n throw new Error(\n `matchesOntologyDataType: ${(odt as any).type} not implemented yet.`,\n );\n }\n}\n\nexport function isMediaReference(o: any): o is MediaReference {\n return (\n typeof o === `object` &&\n typeof o.mimeType === \"string\" &&\n \"reference\" in o &&\n typeof o.reference === \"object\" &&\n o.reference.type === \"mediaSetViewItem\" &&\n \"mediaSetViewItem\" in o.reference &&\n typeof o.reference.mediaSetViewItem === \"object\" &&\n typeof o.reference.mediaSetViewItem.mediaSetRid === \"string\" &&\n typeof o.reference.mediaSetViewItem.mediaSetViewRid === \"string\" &&\n typeof o.reference.mediaSetViewItem.mediaItemRid === \"string\"\n );\n}\n\nexport function isInterfaceActionParam(value: any): value is {\n objectTypeApiName: string;\n primaryKeyValue: string | number | boolean;\n} {\n return (\n typeof value === \"object\" &&\n \"objectTypeApiName\" in value &&\n typeof value.objectTypeApiName === \"string\" &&\n \"primaryKeyValue\" in value &&\n (typeof value.primaryKeyValue === \"string\" ||\n typeof value.primaryKeyValue === \"number\" ||\n typeof value.primaryKeyValue === \"boolean\")\n );\n}\n\nfunction isPoint(obj: any): obj is GeoJSON.Point {\n return (\n obj.type === \"Point\" &&\n Array.isArray(obj.coordinates) &&\n obj.coordinates.length === 2 &&\n typeof obj.coordinates[0] === \"number\" &&\n typeof obj.coordinates[1] === \"number\"\n );\n}\n\nfunction isInBounds(\n value: number,\n bounds: { minimum: number; maximum: number },\n) {\n return bounds.minimum <= value && value <= bounds.maximum;\n}\n\nfunction isValidDateString(value: unknown): boolean {\n if (typeof value !== \"string\") {\n return false;\n }\n\n const dateRegex = /^\\d{4}-\\d{2}-\\d{2}$/u;\n if (!dateRegex.test(value)) {\n return false;\n }\n const date = new Date(value);\n return !isNaN(date.getTime()) && date.toISOString().startsWith(value);\n}\n\nfunction isValidTimestampString(value: unknown): boolean {\n return typeof value === \"string\" && !isNaN(new Date(value).getTime());\n}\n\nfunction isValidCipherText(value: unknown): boolean {\n if (typeof value !== \"string\") {\n return false;\n }\n\n const parts = value.split(\"::\");\n\n if (\n !(\n isValidCipherAffix(parts, \"CIPHER\") ||\n isValidCipherAffix(parts, \"BELLASO\") ||\n isValidCipherAffix(parts, \"BELLASO\", true)\n )\n ) {\n return false;\n }\n\n const channelRid = parts[1];\n const encryptedValue = parts[2];\n\n return channelRid.startsWith(\"ri.\") && encryptedValue !== \"\";\n}\n\nfunction isValidCipherAffix(\n parts: string[],\n affix: \"BELLASO\" | \"CIPHER\",\n prefixOnly: boolean = false,\n): boolean {\n const totalParts = prefixOnly ? 3 : 4;\n\n return (\n parts.length === totalParts &&\n parts[0] === affix &&\n (prefixOnly || parts[3] === affix)\n );\n}\n\nfunction isValidDecimalString(value: unknown): boolean {\n if (typeof value !== \"string\") {\n return false;\n }\n\n const decimalRegex = /^[+-]?(\\d+\\.?\\d*|\\.\\d+)(E[+-]?\\d+)?$/u;\n return decimalRegex.test(value) && !isNaN(parseFloat(value));\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAqBA,MAAMA,sBAML,GAAG;EACFC,IAAI,EAAE;IACJ;IACAC,OAAO,EAAE,CAAC,GAAG;IACbC,OAAO,EAAE;EACX,CAAC;EACDC,MAAM,EAAE;IACN;IACA;IACAF,OAAO,EAAE,CAACG,MAAM,CAACC,SAAS;IAC1BH,OAAO,EAAEE,MAAM,CAACC;EAClB,CAAC;EACDC,KAAK,EAAE;IACL;IACAL,OAAO,EAAE,CAAC,YAAY;IACtBC,OAAO,EAAE;EACX,CAAC;EACDK,OAAO,EAAE;IACP;IACAN,OAAO,EAAE,CAAC,UAAU;IACpBC,OAAO,EAAE;EACX,CAAC;EACDM,IAAI,EAAE;IACJ;IACA;IACAP,OAAO,EAAEG,MAAM,CAACK,gBAAgB;IAChCP,OAAO,EAAEE,MAAM,CAACM;EAClB,CAAC;EACDC,KAAK,EAAE;IACL;IACAV,OAAO,EAAE,CAAC,KAAK;IACfC,OAAO,EAAE;EACX;AACF,CAAU;AAEV,OAAO,SAASU,cAAcA,CAC5BC,OAA2D,EAC3DC,GAAiB,EACjBC,SAAwB,EACE;EAC1B,MAAMC,GAA6B,GAAG;IACpCC,UAAU,EAAE,CAAC,CAAC;IACdC,kBAAkB,EAAE,EAAE;IACtBC,MAAM,EAAE;EACV,CAAC;EACD,KAAK,MAAM,CAACC,CAAC,EAAEC,CAAC,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACT,GAAG,CAACG,UAAU,CAAC,EAAE;IACnD,MAAMO,KAAK,GAAGX,OAAO,CAACI,UAAU,CAACG,CAAC,CAAC;IACnCK,2BAA2B,CAACJ,CAAC,CAACK,QAAQ,EAAEL,CAAC,EAAEG,KAAK,EAAER,GAAG,EAAEI,CAAC,EAAEL,SAA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AAC;AAC9D","ignoreList":[]}
|
package/build/cjs/index.cjs
CHANGED
|
@@ -1426,6 +1426,7 @@ function validateActionParameterType(dataType, paramDef, value, ret, paramKey, d
|
|
|
1426
1426
|
}
|
|
1427
1427
|
case "boolean":
|
|
1428
1428
|
case "date":
|
|
1429
|
+
case "decimal":
|
|
1429
1430
|
case "long":
|
|
1430
1431
|
case "double":
|
|
1431
1432
|
case "integer":
|
|
@@ -2298,7 +2299,7 @@ __export(Actions_exports, {
|
|
|
2298
2299
|
applyBatch: () => applyBatch2
|
|
2299
2300
|
});
|
|
2300
2301
|
|
|
2301
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
2302
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.77.0/node_modules/@osdk/foundry.ontologies/build/esm/public/Action.js
|
|
2302
2303
|
var Action_exports = {};
|
|
2303
2304
|
__export(Action_exports, {
|
|
2304
2305
|
apply: () => apply,
|
|
@@ -2642,7 +2643,7 @@ function parseUrl(baseUrl, endpointPath) {
|
|
|
2642
2643
|
return new URL(`api${endpointPath}`, baseUrl);
|
|
2643
2644
|
}
|
|
2644
2645
|
|
|
2645
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
2646
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.77.0/node_modules/@osdk/foundry.ontologies/build/esm/public/Action.js
|
|
2646
2647
|
var _apply = [1, "/v2/ontologies/{0}/actions/{1}/apply", 7];
|
|
2647
2648
|
function apply($ctx, ...args) {
|
|
2648
2649
|
return foundryPlatformFetch($ctx, _apply, ...args);
|
|
@@ -2664,7 +2665,7 @@ function applyBatchWithOverrides($ctx, ...args) {
|
|
|
2664
2665
|
return foundryPlatformFetch($ctx, _applyBatchWithOverrides, ...args);
|
|
2665
2666
|
}
|
|
2666
2667
|
|
|
2667
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
2668
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.77.0/node_modules/@osdk/foundry.ontologies/build/esm/public/ActionTypeV2.js
|
|
2668
2669
|
var ActionTypeV2_exports = {};
|
|
2669
2670
|
__export(ActionTypeV2_exports, {
|
|
2670
2671
|
get: () => get,
|
|
@@ -2694,7 +2695,7 @@ function getByRidBatch($ctx, ...args) {
|
|
|
2694
2695
|
return foundryPlatformFetch($ctx, _getByRidBatch, ...args);
|
|
2695
2696
|
}
|
|
2696
2697
|
|
|
2697
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
2698
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.77.0/node_modules/@osdk/foundry.ontologies/build/esm/public/Attachment.js
|
|
2698
2699
|
var Attachment_exports = {};
|
|
2699
2700
|
__export(Attachment_exports, {
|
|
2700
2701
|
get: () => get2,
|
|
@@ -2729,7 +2730,7 @@ function get2($ctx, ...args) {
|
|
|
2729
2730
|
return foundryPlatformFetch($ctx, _get2, ...args);
|
|
2730
2731
|
}
|
|
2731
2732
|
|
|
2732
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
2733
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.77.0/node_modules/@osdk/foundry.ontologies/build/esm/public/AttachmentPropertyV2.js
|
|
2733
2734
|
var AttachmentPropertyV2_exports = {};
|
|
2734
2735
|
__export(AttachmentPropertyV2_exports, {
|
|
2735
2736
|
getAttachment: () => getAttachment,
|
|
@@ -2754,7 +2755,7 @@ function readAttachmentByRid($ctx, ...args) {
|
|
|
2754
2755
|
return foundryPlatformFetch($ctx, _readAttachmentByRid, ...args);
|
|
2755
2756
|
}
|
|
2756
2757
|
|
|
2757
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
2758
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.77.0/node_modules/@osdk/foundry.ontologies/build/esm/public/CipherTextProperty.js
|
|
2758
2759
|
var CipherTextProperty_exports = {};
|
|
2759
2760
|
__export(CipherTextProperty_exports, {
|
|
2760
2761
|
decrypt: () => decrypt,
|
|
@@ -2774,7 +2775,7 @@ function encrypt($ctx, ...args) {
|
|
|
2774
2775
|
return foundryPlatformFetch($ctx, _encrypt, ...args);
|
|
2775
2776
|
}
|
|
2776
2777
|
|
|
2777
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
2778
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.77.0/node_modules/@osdk/foundry.ontologies/build/esm/public/LinkedObjectV2.js
|
|
2778
2779
|
var LinkedObjectV2_exports = {};
|
|
2779
2780
|
__export(LinkedObjectV2_exports, {
|
|
2780
2781
|
getLinkedObject: () => getLinkedObject,
|
|
@@ -2789,7 +2790,7 @@ function getLinkedObject($ctx, ...args) {
|
|
|
2789
2790
|
return foundryPlatformFetch($ctx, _getLinkedObject, ...args);
|
|
2790
2791
|
}
|
|
2791
2792
|
|
|
2792
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
2793
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.77.0/node_modules/@osdk/foundry.ontologies/build/esm/public/MediaReferenceProperty.js
|
|
2793
2794
|
var MediaReferenceProperty_exports = {};
|
|
2794
2795
|
__export(MediaReferenceProperty_exports, {
|
|
2795
2796
|
getMediaContent: () => getMediaContent,
|
|
@@ -2809,7 +2810,7 @@ function upload2($ctx, ...args) {
|
|
|
2809
2810
|
return foundryPlatformFetch($ctx, _upload2, ...args);
|
|
2810
2811
|
}
|
|
2811
2812
|
|
|
2812
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
2813
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.77.0/node_modules/@osdk/foundry.ontologies/build/esm/public/ObjectTypeV2.js
|
|
2813
2814
|
var ObjectTypeV2_exports = {};
|
|
2814
2815
|
__export(ObjectTypeV2_exports, {
|
|
2815
2816
|
get: () => get3,
|
|
@@ -2859,7 +2860,7 @@ function getOutgoingLinkTypesByObjectTypeRidBatch($ctx, ...args) {
|
|
|
2859
2860
|
return foundryPlatformFetch($ctx, _getOutgoingLinkTypesByObjectTypeRidBatch, ...args);
|
|
2860
2861
|
}
|
|
2861
2862
|
|
|
2862
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
2863
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.77.0/node_modules/@osdk/foundry.ontologies/build/esm/public/OntologyInterface.js
|
|
2863
2864
|
var OntologyInterface_exports = {};
|
|
2864
2865
|
__export(OntologyInterface_exports, {
|
|
2865
2866
|
aggregate: () => aggregate,
|
|
@@ -2904,7 +2905,7 @@ function listInterfaceLinkedObjects($ctx, ...args) {
|
|
|
2904
2905
|
return foundryPlatformFetch($ctx, _listInterfaceLinkedObjects, ...args);
|
|
2905
2906
|
}
|
|
2906
2907
|
|
|
2907
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
2908
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.77.0/node_modules/@osdk/foundry.ontologies/build/esm/public/OntologyObjectSet.js
|
|
2908
2909
|
var OntologyObjectSet_exports = {};
|
|
2909
2910
|
__export(OntologyObjectSet_exports, {
|
|
2910
2911
|
aggregate: () => aggregate2,
|
|
@@ -2944,7 +2945,7 @@ function loadLinks($ctx, ...args) {
|
|
|
2944
2945
|
return foundryPlatformFetch($ctx, _loadLinks, ...args);
|
|
2945
2946
|
}
|
|
2946
2947
|
|
|
2947
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
2948
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.77.0/node_modules/@osdk/foundry.ontologies/build/esm/public/OntologyObjectV2.js
|
|
2948
2949
|
var OntologyObjectV2_exports = {};
|
|
2949
2950
|
__export(OntologyObjectV2_exports, {
|
|
2950
2951
|
aggregate: () => aggregate3,
|
|
@@ -2974,7 +2975,7 @@ function aggregate3($ctx, ...args) {
|
|
|
2974
2975
|
return foundryPlatformFetch($ctx, _aggregate3, ...args);
|
|
2975
2976
|
}
|
|
2976
2977
|
|
|
2977
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
2978
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.77.0/node_modules/@osdk/foundry.ontologies/build/esm/public/OntologyTransaction.js
|
|
2978
2979
|
var OntologyTransaction_exports = {};
|
|
2979
2980
|
__export(OntologyTransaction_exports, {
|
|
2980
2981
|
postEdits: () => postEdits
|
|
@@ -2984,7 +2985,7 @@ function postEdits($ctx, ...args) {
|
|
|
2984
2985
|
return foundryPlatformFetch($ctx, _postEdits, ...args);
|
|
2985
2986
|
}
|
|
2986
2987
|
|
|
2987
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
2988
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.77.0/node_modules/@osdk/foundry.ontologies/build/esm/public/OntologyV2.js
|
|
2988
2989
|
var OntologyV2_exports = {};
|
|
2989
2990
|
__export(OntologyV2_exports, {
|
|
2990
2991
|
get: () => get7,
|
|
@@ -3009,7 +3010,7 @@ function loadMetadata($ctx, ...args) {
|
|
|
3009
3010
|
return foundryPlatformFetch($ctx, _loadMetadata, ...args);
|
|
3010
3011
|
}
|
|
3011
3012
|
|
|
3012
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
3013
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.77.0/node_modules/@osdk/foundry.ontologies/build/esm/public/Query.js
|
|
3013
3014
|
var Query_exports = {};
|
|
3014
3015
|
__export(Query_exports, {
|
|
3015
3016
|
execute: () => execute
|
|
@@ -3019,7 +3020,7 @@ function execute($ctx, ...args) {
|
|
|
3019
3020
|
return foundryPlatformFetch($ctx, _execute, ...args);
|
|
3020
3021
|
}
|
|
3021
3022
|
|
|
3022
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
3023
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.77.0/node_modules/@osdk/foundry.ontologies/build/esm/public/QueryType.js
|
|
3023
3024
|
var QueryType_exports = {};
|
|
3024
3025
|
__export(QueryType_exports, {
|
|
3025
3026
|
get: () => get8,
|
|
@@ -3039,7 +3040,7 @@ function getByRidBatch3($ctx, ...args) {
|
|
|
3039
3040
|
return foundryPlatformFetch($ctx, _getByRidBatch3, ...args);
|
|
3040
3041
|
}
|
|
3041
3042
|
|
|
3042
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
3043
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.77.0/node_modules/@osdk/foundry.ontologies/build/esm/public/TimeSeriesPropertyV2.js
|
|
3043
3044
|
var TimeSeriesPropertyV2_exports = {};
|
|
3044
3045
|
__export(TimeSeriesPropertyV2_exports, {
|
|
3045
3046
|
getFirstPoint: () => getFirstPoint,
|
|
@@ -3059,7 +3060,7 @@ function streamPoints($ctx, ...args) {
|
|
|
3059
3060
|
return foundryPlatformFetch($ctx, _streamPoints, ...args);
|
|
3060
3061
|
}
|
|
3061
3062
|
|
|
3062
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
3063
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.77.0/node_modules/@osdk/foundry.ontologies/build/esm/public/TimeSeriesValueBankProperty.js
|
|
3063
3064
|
var TimeSeriesValueBankProperty_exports = {};
|
|
3064
3065
|
__export(TimeSeriesValueBankProperty_exports, {
|
|
3065
3066
|
getLatestValue: () => getLatestValue,
|
|
@@ -3136,7 +3137,7 @@ __export(MediaReferenceProperties_exports, {
|
|
|
3136
3137
|
uploadMedia: () => uploadMedia2
|
|
3137
3138
|
});
|
|
3138
3139
|
|
|
3139
|
-
// ../../node_modules/.pnpm/@osdk+foundry.mediasets@2.
|
|
3140
|
+
// ../../node_modules/.pnpm/@osdk+foundry.mediasets@2.77.0/node_modules/@osdk/foundry.mediasets/build/esm/public/MediaSet.js
|
|
3140
3141
|
var MediaSet_exports = {};
|
|
3141
3142
|
__export(MediaSet_exports, {
|
|
3142
3143
|
abort: () => abort,
|
|
@@ -4355,6 +4356,7 @@ var FauxOntology = class {
|
|
|
4355
4356
|
constructor(ontology) {
|
|
4356
4357
|
this.#ontology = {
|
|
4357
4358
|
actionTypes: {},
|
|
4359
|
+
actionTypesFullMetadata: {},
|
|
4358
4360
|
interfaceTypes: {},
|
|
4359
4361
|
objectTypes: {},
|
|
4360
4362
|
ontology,
|
|
@@ -4377,6 +4379,7 @@ var FauxOntology = class {
|
|
|
4377
4379
|
linkTypes: objectTypeDefinition.linkTypes.filter((linkType) => request.linkTypes.includes(linkType.apiName))
|
|
4378
4380
|
}])),
|
|
4379
4381
|
actionTypes: filterRecord(this.#ontology.actionTypes, request.actionTypes),
|
|
4382
|
+
actionTypesFullMetadata: {},
|
|
4380
4383
|
queryTypes: this.#getFilteredQueryTypes(request),
|
|
4381
4384
|
interfaceTypes: filterRecord(this.#ontology.interfaceTypes, request.interfaceTypes),
|
|
4382
4385
|
sharedPropertyTypes: {},
|