@osdk/faux 0.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1047 -0
- package/build/browser/BaseError.js +21 -0
- package/build/browser/BaseError.js.map +1 -0
- package/build/browser/FauxFoundry/BaseOsdkObjectType.js +2 -0
- package/build/browser/FauxFoundry/BaseOsdkObjectType.js.map +1 -0
- package/build/browser/FauxFoundry/BaseServerObject.js +30 -0
- package/build/browser/FauxFoundry/BaseServerObject.js.map +1 -0
- package/build/browser/FauxFoundry/FauxActionImpl.js +2 -0
- package/build/browser/FauxFoundry/FauxActionImpl.js.map +1 -0
- package/build/browser/FauxFoundry/FauxAttachmentStore.js +60 -0
- package/build/browser/FauxFoundry/FauxAttachmentStore.js.map +1 -0
- package/build/browser/FauxFoundry/FauxDataStore.js +470 -0
- package/build/browser/FauxFoundry/FauxDataStore.js.map +1 -0
- package/build/browser/FauxFoundry/FauxDataStore.test.js +190 -0
- package/build/browser/FauxFoundry/FauxDataStore.test.js.map +1 -0
- package/build/browser/FauxFoundry/FauxDataStoreBatch.js +125 -0
- package/build/browser/FauxFoundry/FauxDataStoreBatch.js.map +1 -0
- package/build/browser/FauxFoundry/FauxFoundry.js +87 -0
- package/build/browser/FauxFoundry/FauxFoundry.js.map +1 -0
- package/build/browser/FauxFoundry/FauxOntology.js +228 -0
- package/build/browser/FauxFoundry/FauxOntology.js.map +1 -0
- package/build/browser/FauxFoundry/FauxQueryImpl.js +2 -0
- package/build/browser/FauxFoundry/FauxQueryImpl.js.map +1 -0
- package/build/browser/FauxFoundry/ObjectLocator.js +29 -0
- package/build/browser/FauxFoundry/ObjectLocator.js.map +1 -0
- package/build/browser/FauxFoundry/filterObjects.js +122 -0
- package/build/browser/FauxFoundry/filterObjects.js.map +1 -0
- package/build/browser/FauxFoundry/filterTimeSeriesData.js +70 -0
- package/build/browser/FauxFoundry/filterTimeSeriesData.js.map +1 -0
- package/build/browser/FauxFoundry/filterTimeSeriesData.test.js +116 -0
- package/build/browser/FauxFoundry/filterTimeSeriesData.test.js.map +1 -0
- package/build/browser/FauxFoundry/getObjectsFromSet.js +217 -0
- package/build/browser/FauxFoundry/getObjectsFromSet.js.map +1 -0
- package/build/browser/FauxFoundry/typeHelpers/ActionTypeBuilder.js +64 -0
- package/build/browser/FauxFoundry/typeHelpers/ActionTypeBuilder.js.map +1 -0
- package/build/browser/FauxFoundry/typeHelpers/JustProps.js +2 -0
- package/build/browser/FauxFoundry/typeHelpers/JustProps.js.map +1 -0
- package/build/browser/FauxFoundry/typeHelpers/TH_ActionDefinition.js +2 -0
- package/build/browser/FauxFoundry/typeHelpers/TH_ActionDefinition.js.map +1 -0
- package/build/browser/FauxFoundry/typeHelpers/TH_ActionParameterV2.js +25 -0
- package/build/browser/FauxFoundry/typeHelpers/TH_ActionParameterV2.js.map +1 -0
- package/build/browser/FauxFoundry/typeHelpers/TH_ActionTypeV2.js +35 -0
- package/build/browser/FauxFoundry/typeHelpers/TH_ActionTypeV2.js.map +1 -0
- package/build/browser/FauxFoundry/typeHelpers/TH_ApplyActionRequestV2.js +2 -0
- package/build/browser/FauxFoundry/typeHelpers/TH_ApplyActionRequestV2.js.map +1 -0
- package/build/browser/FauxFoundry/typeHelpers/TH_ObjectTypeFullMetadata.js +2 -0
- package/build/browser/FauxFoundry/typeHelpers/TH_ObjectTypeFullMetadata.js.map +1 -0
- package/build/browser/FauxFoundry/typeHelpers/ToObjectTypeDefinition.js +2 -0
- package/build/browser/FauxFoundry/typeHelpers/ToObjectTypeDefinition.js.map +1 -0
- package/build/browser/FauxFoundry/typeHelpers/index.js +20 -0
- package/build/browser/FauxFoundry/typeHelpers/index.js.map +1 -0
- package/build/browser/FauxFoundry/validateAction.js +245 -0
- package/build/browser/FauxFoundry/validateAction.js.map +1 -0
- package/build/browser/defaultOntologyForConjure.js +25 -0
- package/build/browser/defaultOntologyForConjure.js.map +1 -0
- package/build/browser/defaultOntologyMetadata.js +23 -0
- package/build/browser/defaultOntologyMetadata.js.map +1 -0
- package/build/browser/errors.js +134 -0
- package/build/browser/errors.js.map +1 -0
- package/build/browser/filterObjects.js +86 -0
- package/build/browser/filterObjects.js.map +1 -0
- package/build/browser/handlers/authHandlerMiddleware.js +41 -0
- package/build/browser/handlers/authHandlerMiddleware.js.map +1 -0
- package/build/browser/handlers/createActionHandlers.js +49 -0
- package/build/browser/handlers/createActionHandlers.js.map +1 -0
- package/build/browser/handlers/createAttachmentHandlers.js +88 -0
- package/build/browser/handlers/createAttachmentHandlers.js.map +1 -0
- package/build/browser/handlers/createFauxFoundryHandlers.js +29 -0
- package/build/browser/handlers/createFauxFoundryHandlers.js.map +1 -0
- package/build/browser/handlers/createLoadObjectsHandlers.js +91 -0
- package/build/browser/handlers/createLoadObjectsHandlers.js.map +1 -0
- package/build/browser/handlers/createMediaRefHandlers.js +70 -0
- package/build/browser/handlers/createMediaRefHandlers.js.map +1 -0
- package/build/browser/handlers/createMultipassServerHandlers.js +67 -0
- package/build/browser/handlers/createMultipassServerHandlers.js.map +1 -0
- package/build/browser/handlers/createObjectSetHandlers.js +50 -0
- package/build/browser/handlers/createObjectSetHandlers.js.map +1 -0
- package/build/browser/handlers/createOntologyHandlers.js +122 -0
- package/build/browser/handlers/createOntologyHandlers.js.map +1 -0
- package/build/browser/handlers/createQueryHandlers.js +38 -0
- package/build/browser/handlers/createQueryHandlers.js.map +1 -0
- package/build/browser/handlers/createTimeseriesAndGeotimeHandlers.js +95 -0
- package/build/browser/handlers/createTimeseriesAndGeotimeHandlers.js.map +1 -0
- package/build/browser/handlers/util/getPaginationParams.js +33 -0
- package/build/browser/handlers/util/getPaginationParams.js.map +1 -0
- package/build/browser/handlers/util/handleOpenApiCall.js +85 -0
- package/build/browser/handlers/util/handleOpenApiCall.js.map +1 -0
- package/build/browser/handlers/util/loadAll.js +24 -0
- package/build/browser/handlers/util/loadAll.js.map +1 -0
- package/build/browser/handlers/util/pageThroughResponseSearchParams.js +39 -0
- package/build/browser/handlers/util/pageThroughResponseSearchParams.js.map +1 -0
- package/build/browser/handlers/util/requireParam.js +29 -0
- package/build/browser/handlers/util/requireParam.js.map +1 -0
- package/build/browser/handlers/util/requireSearchParams.js +29 -0
- package/build/browser/handlers/util/requireSearchParams.js.map +1 -0
- package/build/browser/index.js +29 -0
- package/build/browser/index.js.map +1 -0
- package/build/browser/mock/OntologiesV2/ActionTypesV2.js +21 -0
- package/build/browser/mock/OntologiesV2/ActionTypesV2.js.map +1 -0
- package/build/browser/mock/OntologiesV2/Actions.js +21 -0
- package/build/browser/mock/OntologiesV2/Actions.js.map +1 -0
- package/build/browser/mock/OntologiesV2/AttachmentPropertiesV2.js +21 -0
- package/build/browser/mock/OntologiesV2/AttachmentPropertiesV2.js.map +1 -0
- package/build/browser/mock/OntologiesV2/Attachments.js +22 -0
- package/build/browser/mock/OntologiesV2/Attachments.js.map +1 -0
- package/build/browser/mock/OntologiesV2/LinkedObjectsV2.js +21 -0
- package/build/browser/mock/OntologiesV2/LinkedObjectsV2.js.map +1 -0
- package/build/browser/mock/OntologiesV2/MediaReferenceProperties.js +22 -0
- package/build/browser/mock/OntologiesV2/MediaReferenceProperties.js.map +1 -0
- package/build/browser/mock/OntologiesV2/ObjectTypesV2.js +24 -0
- package/build/browser/mock/OntologiesV2/ObjectTypesV2.js.map +1 -0
- package/build/browser/mock/OntologiesV2/OntologiesV2.js +27 -0
- package/build/browser/mock/OntologiesV2/OntologiesV2.js.map +1 -0
- package/build/browser/mock/OntologiesV2/OntologyInterfaces.js +21 -0
- package/build/browser/mock/OntologiesV2/OntologyInterfaces.js.map +1 -0
- package/build/browser/mock/OntologiesV2/OntologyObjectSets.js +22 -0
- package/build/browser/mock/OntologiesV2/OntologyObjectSets.js.map +1 -0
- package/build/browser/mock/OntologiesV2/OntologyObjectsV2.js +21 -0
- package/build/browser/mock/OntologiesV2/OntologyObjectsV2.js.map +1 -0
- package/build/browser/mock/OntologiesV2/Queries.js +20 -0
- package/build/browser/mock/OntologiesV2/Queries.js.map +1 -0
- package/build/browser/mock/OntologiesV2/QueryTypes.js +21 -0
- package/build/browser/mock/OntologiesV2/QueryTypes.js.map +1 -0
- package/build/browser/mock/OntologiesV2/TimeSeriesPropertiesV2.js +22 -0
- package/build/browser/mock/OntologiesV2/TimeSeriesPropertiesV2.js.map +1 -0
- package/build/browser/mock/OntologiesV2/TimeSeriesValueBankProperties.js +21 -0
- package/build/browser/mock/OntologiesV2/TimeSeriesValueBankProperties.js.map +1 -0
- package/build/browser/mock/OntologiesV2/index.js +32 -0
- package/build/browser/mock/OntologiesV2/index.js.map +1 -0
- package/build/browser/mock/index.js +18 -0
- package/build/browser/mock/index.js.map +1 -0
- package/build/browser/withoutRid.js +24 -0
- package/build/browser/withoutRid.js.map +1 -0
- package/build/cjs/index.cjs +2983 -0
- package/build/cjs/index.cjs.map +1 -0
- package/build/cjs/index.d.cts +562 -0
- package/build/esm/BaseError.js +21 -0
- package/build/esm/BaseError.js.map +1 -0
- package/build/esm/FauxFoundry/BaseOsdkObjectType.js +2 -0
- package/build/esm/FauxFoundry/BaseOsdkObjectType.js.map +1 -0
- package/build/esm/FauxFoundry/BaseServerObject.js +30 -0
- package/build/esm/FauxFoundry/BaseServerObject.js.map +1 -0
- package/build/esm/FauxFoundry/FauxActionImpl.js +2 -0
- package/build/esm/FauxFoundry/FauxActionImpl.js.map +1 -0
- package/build/esm/FauxFoundry/FauxAttachmentStore.js +60 -0
- package/build/esm/FauxFoundry/FauxAttachmentStore.js.map +1 -0
- package/build/esm/FauxFoundry/FauxDataStore.js +470 -0
- package/build/esm/FauxFoundry/FauxDataStore.js.map +1 -0
- package/build/esm/FauxFoundry/FauxDataStore.test.js +190 -0
- package/build/esm/FauxFoundry/FauxDataStore.test.js.map +1 -0
- package/build/esm/FauxFoundry/FauxDataStoreBatch.js +125 -0
- package/build/esm/FauxFoundry/FauxDataStoreBatch.js.map +1 -0
- package/build/esm/FauxFoundry/FauxFoundry.js +87 -0
- package/build/esm/FauxFoundry/FauxFoundry.js.map +1 -0
- package/build/esm/FauxFoundry/FauxOntology.js +228 -0
- package/build/esm/FauxFoundry/FauxOntology.js.map +1 -0
- package/build/esm/FauxFoundry/FauxQueryImpl.js +2 -0
- package/build/esm/FauxFoundry/FauxQueryImpl.js.map +1 -0
- package/build/esm/FauxFoundry/ObjectLocator.js +29 -0
- package/build/esm/FauxFoundry/ObjectLocator.js.map +1 -0
- package/build/esm/FauxFoundry/filterObjects.js +122 -0
- package/build/esm/FauxFoundry/filterObjects.js.map +1 -0
- package/build/esm/FauxFoundry/filterTimeSeriesData.js +70 -0
- package/build/esm/FauxFoundry/filterTimeSeriesData.js.map +1 -0
- package/build/esm/FauxFoundry/filterTimeSeriesData.test.js +116 -0
- package/build/esm/FauxFoundry/filterTimeSeriesData.test.js.map +1 -0
- package/build/esm/FauxFoundry/getObjectsFromSet.js +217 -0
- package/build/esm/FauxFoundry/getObjectsFromSet.js.map +1 -0
- package/build/esm/FauxFoundry/typeHelpers/ActionTypeBuilder.js +64 -0
- package/build/esm/FauxFoundry/typeHelpers/ActionTypeBuilder.js.map +1 -0
- package/build/esm/FauxFoundry/typeHelpers/JustProps.js +2 -0
- package/build/esm/FauxFoundry/typeHelpers/JustProps.js.map +1 -0
- package/build/esm/FauxFoundry/typeHelpers/TH_ActionDefinition.js +2 -0
- package/build/esm/FauxFoundry/typeHelpers/TH_ActionDefinition.js.map +1 -0
- package/build/esm/FauxFoundry/typeHelpers/TH_ActionParameterV2.js +25 -0
- package/build/esm/FauxFoundry/typeHelpers/TH_ActionParameterV2.js.map +1 -0
- package/build/esm/FauxFoundry/typeHelpers/TH_ActionTypeV2.js +35 -0
- package/build/esm/FauxFoundry/typeHelpers/TH_ActionTypeV2.js.map +1 -0
- package/build/esm/FauxFoundry/typeHelpers/TH_ApplyActionRequestV2.js +2 -0
- package/build/esm/FauxFoundry/typeHelpers/TH_ApplyActionRequestV2.js.map +1 -0
- package/build/esm/FauxFoundry/typeHelpers/TH_ObjectTypeFullMetadata.js +2 -0
- package/build/esm/FauxFoundry/typeHelpers/TH_ObjectTypeFullMetadata.js.map +1 -0
- package/build/esm/FauxFoundry/typeHelpers/ToObjectTypeDefinition.js +2 -0
- package/build/esm/FauxFoundry/typeHelpers/ToObjectTypeDefinition.js.map +1 -0
- package/build/esm/FauxFoundry/typeHelpers/index.js +20 -0
- package/build/esm/FauxFoundry/typeHelpers/index.js.map +1 -0
- package/build/esm/FauxFoundry/validateAction.js +245 -0
- package/build/esm/FauxFoundry/validateAction.js.map +1 -0
- package/build/esm/defaultOntologyForConjure.js +25 -0
- package/build/esm/defaultOntologyForConjure.js.map +1 -0
- package/build/esm/defaultOntologyMetadata.js +23 -0
- package/build/esm/defaultOntologyMetadata.js.map +1 -0
- package/build/esm/errors.js +134 -0
- package/build/esm/errors.js.map +1 -0
- package/build/esm/filterObjects.js +86 -0
- package/build/esm/filterObjects.js.map +1 -0
- package/build/esm/handlers/authHandlerMiddleware.js +41 -0
- package/build/esm/handlers/authHandlerMiddleware.js.map +1 -0
- package/build/esm/handlers/createActionHandlers.js +49 -0
- package/build/esm/handlers/createActionHandlers.js.map +1 -0
- package/build/esm/handlers/createAttachmentHandlers.js +88 -0
- package/build/esm/handlers/createAttachmentHandlers.js.map +1 -0
- package/build/esm/handlers/createFauxFoundryHandlers.js +29 -0
- package/build/esm/handlers/createFauxFoundryHandlers.js.map +1 -0
- package/build/esm/handlers/createLoadObjectsHandlers.js +91 -0
- package/build/esm/handlers/createLoadObjectsHandlers.js.map +1 -0
- package/build/esm/handlers/createMediaRefHandlers.js +70 -0
- package/build/esm/handlers/createMediaRefHandlers.js.map +1 -0
- package/build/esm/handlers/createMultipassServerHandlers.js +67 -0
- package/build/esm/handlers/createMultipassServerHandlers.js.map +1 -0
- package/build/esm/handlers/createObjectSetHandlers.js +50 -0
- package/build/esm/handlers/createObjectSetHandlers.js.map +1 -0
- package/build/esm/handlers/createOntologyHandlers.js +122 -0
- package/build/esm/handlers/createOntologyHandlers.js.map +1 -0
- package/build/esm/handlers/createQueryHandlers.js +38 -0
- package/build/esm/handlers/createQueryHandlers.js.map +1 -0
- package/build/esm/handlers/createTimeseriesAndGeotimeHandlers.js +95 -0
- package/build/esm/handlers/createTimeseriesAndGeotimeHandlers.js.map +1 -0
- package/build/esm/handlers/util/getPaginationParams.js +33 -0
- package/build/esm/handlers/util/getPaginationParams.js.map +1 -0
- package/build/esm/handlers/util/handleOpenApiCall.js +85 -0
- package/build/esm/handlers/util/handleOpenApiCall.js.map +1 -0
- package/build/esm/handlers/util/loadAll.js +24 -0
- package/build/esm/handlers/util/loadAll.js.map +1 -0
- package/build/esm/handlers/util/pageThroughResponseSearchParams.js +39 -0
- package/build/esm/handlers/util/pageThroughResponseSearchParams.js.map +1 -0
- package/build/esm/handlers/util/requireParam.js +29 -0
- package/build/esm/handlers/util/requireParam.js.map +1 -0
- package/build/esm/handlers/util/requireSearchParams.js +29 -0
- package/build/esm/handlers/util/requireSearchParams.js.map +1 -0
- package/build/esm/index.js +29 -0
- package/build/esm/index.js.map +1 -0
- package/build/esm/mock/OntologiesV2/ActionTypesV2.js +21 -0
- package/build/esm/mock/OntologiesV2/ActionTypesV2.js.map +1 -0
- package/build/esm/mock/OntologiesV2/Actions.js +21 -0
- package/build/esm/mock/OntologiesV2/Actions.js.map +1 -0
- package/build/esm/mock/OntologiesV2/AttachmentPropertiesV2.js +21 -0
- package/build/esm/mock/OntologiesV2/AttachmentPropertiesV2.js.map +1 -0
- package/build/esm/mock/OntologiesV2/Attachments.js +22 -0
- package/build/esm/mock/OntologiesV2/Attachments.js.map +1 -0
- package/build/esm/mock/OntologiesV2/LinkedObjectsV2.js +21 -0
- package/build/esm/mock/OntologiesV2/LinkedObjectsV2.js.map +1 -0
- package/build/esm/mock/OntologiesV2/MediaReferenceProperties.js +22 -0
- package/build/esm/mock/OntologiesV2/MediaReferenceProperties.js.map +1 -0
- package/build/esm/mock/OntologiesV2/ObjectTypesV2.js +24 -0
- package/build/esm/mock/OntologiesV2/ObjectTypesV2.js.map +1 -0
- package/build/esm/mock/OntologiesV2/OntologiesV2.js +27 -0
- package/build/esm/mock/OntologiesV2/OntologiesV2.js.map +1 -0
- package/build/esm/mock/OntologiesV2/OntologyInterfaces.js +21 -0
- package/build/esm/mock/OntologiesV2/OntologyInterfaces.js.map +1 -0
- package/build/esm/mock/OntologiesV2/OntologyObjectSets.js +22 -0
- package/build/esm/mock/OntologiesV2/OntologyObjectSets.js.map +1 -0
- package/build/esm/mock/OntologiesV2/OntologyObjectsV2.js +21 -0
- package/build/esm/mock/OntologiesV2/OntologyObjectsV2.js.map +1 -0
- package/build/esm/mock/OntologiesV2/Queries.js +20 -0
- package/build/esm/mock/OntologiesV2/Queries.js.map +1 -0
- package/build/esm/mock/OntologiesV2/QueryTypes.js +21 -0
- package/build/esm/mock/OntologiesV2/QueryTypes.js.map +1 -0
- package/build/esm/mock/OntologiesV2/TimeSeriesPropertiesV2.js +22 -0
- package/build/esm/mock/OntologiesV2/TimeSeriesPropertiesV2.js.map +1 -0
- package/build/esm/mock/OntologiesV2/TimeSeriesValueBankProperties.js +21 -0
- package/build/esm/mock/OntologiesV2/TimeSeriesValueBankProperties.js.map +1 -0
- package/build/esm/mock/OntologiesV2/index.js +32 -0
- package/build/esm/mock/OntologiesV2/index.js.map +1 -0
- package/build/esm/mock/index.js +18 -0
- package/build/esm/mock/index.js.map +1 -0
- package/build/esm/withoutRid.js +24 -0
- package/build/esm/withoutRid.js.map +1 -0
- package/build/types/BaseError.d.ts +7 -0
- package/build/types/BaseError.d.ts.map +1 -0
- package/build/types/FauxFoundry/BaseOsdkObjectType.d.ts +5 -0
- package/build/types/FauxFoundry/BaseOsdkObjectType.d.ts.map +1 -0
- package/build/types/FauxFoundry/BaseServerObject.d.ts +18 -0
- package/build/types/FauxFoundry/BaseServerObject.d.ts.map +1 -0
- package/build/types/FauxFoundry/FauxActionImpl.d.ts +8 -0
- package/build/types/FauxFoundry/FauxActionImpl.d.ts.map +1 -0
- package/build/types/FauxFoundry/FauxAttachmentStore.d.ts +10 -0
- package/build/types/FauxFoundry/FauxAttachmentStore.d.ts.map +1 -0
- package/build/types/FauxFoundry/FauxDataStore.d.ts +70 -0
- package/build/types/FauxFoundry/FauxDataStore.d.ts.map +1 -0
- package/build/types/FauxFoundry/FauxDataStore.test.d.ts +1 -0
- package/build/types/FauxFoundry/FauxDataStore.test.d.ts.map +1 -0
- package/build/types/FauxFoundry/FauxDataStoreBatch.d.ts +22 -0
- package/build/types/FauxFoundry/FauxDataStoreBatch.d.ts.map +1 -0
- package/build/types/FauxFoundry/FauxFoundry.d.ts +25 -0
- package/build/types/FauxFoundry/FauxFoundry.d.ts.map +1 -0
- package/build/types/FauxFoundry/FauxOntology.d.ts +39 -0
- package/build/types/FauxFoundry/FauxOntology.d.ts.map +1 -0
- package/build/types/FauxFoundry/FauxQueryImpl.d.ts +5 -0
- package/build/types/FauxFoundry/FauxQueryImpl.d.ts.map +1 -0
- package/build/types/FauxFoundry/ObjectLocator.d.ts +11 -0
- package/build/types/FauxFoundry/ObjectLocator.d.ts.map +1 -0
- package/build/types/FauxFoundry/filterObjects.d.ts +3 -0
- package/build/types/FauxFoundry/filterObjects.d.ts.map +1 -0
- package/build/types/FauxFoundry/filterTimeSeriesData.d.ts +2 -0
- package/build/types/FauxFoundry/filterTimeSeriesData.d.ts.map +1 -0
- package/build/types/FauxFoundry/filterTimeSeriesData.test.d.ts +1 -0
- package/build/types/FauxFoundry/filterTimeSeriesData.test.d.ts.map +1 -0
- package/build/types/FauxFoundry/getObjectsFromSet.d.ts +6 -0
- package/build/types/FauxFoundry/getObjectsFromSet.d.ts.map +1 -0
- package/build/types/FauxFoundry/typeHelpers/ActionTypeBuilder.d.ts +27 -0
- package/build/types/FauxFoundry/typeHelpers/ActionTypeBuilder.d.ts.map +1 -0
- package/build/types/FauxFoundry/typeHelpers/JustProps.d.ts +4 -0
- package/build/types/FauxFoundry/typeHelpers/JustProps.d.ts.map +1 -0
- package/build/types/FauxFoundry/typeHelpers/TH_ActionDefinition.d.ts +43 -0
- package/build/types/FauxFoundry/typeHelpers/TH_ActionDefinition.d.ts.map +1 -0
- package/build/types/FauxFoundry/typeHelpers/TH_ActionParameterV2.d.ts +15 -0
- package/build/types/FauxFoundry/typeHelpers/TH_ActionParameterV2.d.ts.map +1 -0
- package/build/types/FauxFoundry/typeHelpers/TH_ActionTypeV2.d.ts +8 -0
- package/build/types/FauxFoundry/typeHelpers/TH_ActionTypeV2.d.ts.map +1 -0
- package/build/types/FauxFoundry/typeHelpers/TH_ApplyActionRequestV2.d.ts +24 -0
- package/build/types/FauxFoundry/typeHelpers/TH_ApplyActionRequestV2.d.ts.map +1 -0
- package/build/types/FauxFoundry/typeHelpers/TH_ObjectTypeFullMetadata.d.ts +18 -0
- package/build/types/FauxFoundry/typeHelpers/TH_ObjectTypeFullMetadata.d.ts.map +1 -0
- package/build/types/FauxFoundry/typeHelpers/ToObjectTypeDefinition.d.ts +12 -0
- package/build/types/FauxFoundry/typeHelpers/ToObjectTypeDefinition.d.ts.map +1 -0
- package/build/types/FauxFoundry/typeHelpers/index.d.ts +10 -0
- package/build/types/FauxFoundry/typeHelpers/index.d.ts.map +1 -0
- package/build/types/FauxFoundry/validateAction.d.ts +9 -0
- package/build/types/FauxFoundry/validateAction.d.ts.map +1 -0
- package/build/types/defaultOntologyForConjure.d.ts +7 -0
- package/build/types/defaultOntologyForConjure.d.ts.map +1 -0
- package/build/types/defaultOntologyMetadata.d.ts +2 -0
- package/build/types/defaultOntologyMetadata.d.ts.map +1 -0
- package/build/types/errors.d.ts +14 -0
- package/build/types/errors.d.ts.map +1 -0
- package/build/types/filterObjects.d.ts +8 -0
- package/build/types/filterObjects.d.ts.map +1 -0
- package/build/types/handlers/authHandlerMiddleware.d.ts +5 -0
- package/build/types/handlers/authHandlerMiddleware.d.ts.map +1 -0
- package/build/types/handlers/createActionHandlers.d.ts +3 -0
- package/build/types/handlers/createActionHandlers.d.ts.map +1 -0
- package/build/types/handlers/createAttachmentHandlers.d.ts +2 -0
- package/build/types/handlers/createAttachmentHandlers.d.ts.map +1 -0
- package/build/types/handlers/createFauxFoundryHandlers.d.ts +4 -0
- package/build/types/handlers/createFauxFoundryHandlers.d.ts.map +1 -0
- package/build/types/handlers/createLoadObjectsHandlers.d.ts +2 -0
- package/build/types/handlers/createLoadObjectsHandlers.d.ts.map +1 -0
- package/build/types/handlers/createMediaRefHandlers.d.ts +2 -0
- package/build/types/handlers/createMediaRefHandlers.d.ts.map +1 -0
- package/build/types/handlers/createMultipassServerHandlers.d.ts +2 -0
- package/build/types/handlers/createMultipassServerHandlers.d.ts.map +1 -0
- package/build/types/handlers/createObjectSetHandlers.d.ts +3 -0
- package/build/types/handlers/createObjectSetHandlers.d.ts.map +1 -0
- package/build/types/handlers/createOntologyHandlers.d.ts +4 -0
- package/build/types/handlers/createOntologyHandlers.d.ts.map +1 -0
- package/build/types/handlers/createQueryHandlers.d.ts +2 -0
- package/build/types/handlers/createQueryHandlers.d.ts.map +1 -0
- package/build/types/handlers/createTimeseriesAndGeotimeHandlers.d.ts +2 -0
- package/build/types/handlers/createTimeseriesAndGeotimeHandlers.d.ts.map +1 -0
- package/build/types/handlers/util/getPaginationParams.d.ts +11 -0
- package/build/types/handlers/util/getPaginationParams.d.ts.map +1 -0
- package/build/types/handlers/util/handleOpenApiCall.d.ts +49 -0
- package/build/types/handlers/util/handleOpenApiCall.d.ts.map +1 -0
- package/build/types/handlers/util/loadAll.d.ts +1 -0
- package/build/types/handlers/util/loadAll.d.ts.map +1 -0
- package/build/types/handlers/util/pageThroughResponseSearchParams.d.ts +20 -0
- package/build/types/handlers/util/pageThroughResponseSearchParams.d.ts.map +1 -0
- package/build/types/handlers/util/requireParam.d.ts +8 -0
- package/build/types/handlers/util/requireParam.d.ts.map +1 -0
- package/build/types/handlers/util/requireSearchParams.d.ts +2 -0
- package/build/types/handlers/util/requireSearchParams.d.ts.map +1 -0
- package/build/types/index.d.ts +14 -0
- package/build/types/index.d.ts.map +1 -0
- package/build/types/mock/OntologiesV2/ActionTypesV2.d.ts +4 -0
- package/build/types/mock/OntologiesV2/ActionTypesV2.d.ts.map +1 -0
- package/build/types/mock/OntologiesV2/Actions.d.ts +4 -0
- package/build/types/mock/OntologiesV2/Actions.d.ts.map +1 -0
- package/build/types/mock/OntologiesV2/AttachmentPropertiesV2.d.ts +4 -0
- package/build/types/mock/OntologiesV2/AttachmentPropertiesV2.d.ts.map +1 -0
- package/build/types/mock/OntologiesV2/Attachments.d.ts +5 -0
- package/build/types/mock/OntologiesV2/Attachments.d.ts.map +1 -0
- package/build/types/mock/OntologiesV2/LinkedObjectsV2.d.ts +4 -0
- package/build/types/mock/OntologiesV2/LinkedObjectsV2.d.ts.map +1 -0
- package/build/types/mock/OntologiesV2/MediaReferenceProperties.d.ts +5 -0
- package/build/types/mock/OntologiesV2/MediaReferenceProperties.d.ts.map +1 -0
- package/build/types/mock/OntologiesV2/ObjectTypesV2.d.ts +7 -0
- package/build/types/mock/OntologiesV2/ObjectTypesV2.d.ts.map +1 -0
- package/build/types/mock/OntologiesV2/OntologiesV2.d.ts +9 -0
- package/build/types/mock/OntologiesV2/OntologiesV2.d.ts.map +1 -0
- package/build/types/mock/OntologiesV2/OntologyInterfaces.d.ts +4 -0
- package/build/types/mock/OntologiesV2/OntologyInterfaces.d.ts.map +1 -0
- package/build/types/mock/OntologiesV2/OntologyObjectSets.d.ts +5 -0
- package/build/types/mock/OntologiesV2/OntologyObjectSets.d.ts.map +1 -0
- package/build/types/mock/OntologiesV2/OntologyObjectsV2.d.ts +4 -0
- package/build/types/mock/OntologiesV2/OntologyObjectsV2.d.ts.map +1 -0
- package/build/types/mock/OntologiesV2/Queries.d.ts +3 -0
- package/build/types/mock/OntologiesV2/Queries.d.ts.map +1 -0
- package/build/types/mock/OntologiesV2/QueryTypes.d.ts +4 -0
- package/build/types/mock/OntologiesV2/QueryTypes.d.ts.map +1 -0
- package/build/types/mock/OntologiesV2/TimeSeriesPropertiesV2.d.ts +5 -0
- package/build/types/mock/OntologiesV2/TimeSeriesPropertiesV2.d.ts.map +1 -0
- package/build/types/mock/OntologiesV2/TimeSeriesValueBankProperties.d.ts +4 -0
- package/build/types/mock/OntologiesV2/TimeSeriesValueBankProperties.d.ts.map +1 -0
- package/build/types/mock/OntologiesV2/index.d.ts +15 -0
- package/build/types/mock/OntologiesV2/index.d.ts.map +1 -0
- package/build/types/mock/index.d.ts +1 -0
- package/build/types/mock/index.d.ts.map +1 -0
- package/build/types/withoutRid.d.ts +3 -0
- package/build/types/withoutRid.d.ts.map +1 -0
- package/package.json +88 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
// These are the shape of the errors that come back from the API.
|
|
18
|
+
export function isBaseApiError(error) {
|
|
19
|
+
return error && typeof error === "object" && "errorCode" in error && "errorName" in error && "errorInstanceId" in error;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=BaseError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseError.js","names":["isBaseApiError","error"],"sources":["BaseError.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\nexport interface BaseAPIError {\n errorCode: string;\n errorName: string;\n errorInstanceId: string;\n parameters: Record<string, any>;\n}\n\n// These are the shape of the errors that come back from the API.\nexport function isBaseApiError(error: any): error is BaseAPIError {\n return (\n error && typeof error === \"object\" && \"errorCode\" in error\n && \"errorName\" in error && \"errorInstanceId\" in error\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA;AACA,OAAO,SAASA,cAAcA,CAACC,KAAU,EAAyB;EAChE,OACEA,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAI,WAAW,IAAIA,KAAK,IACvD,WAAW,IAAIA,KAAK,IAAI,iBAAiB,IAAIA,KAAK;AAEzD","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseOsdkObjectType.js","names":[],"sources":["BaseOsdkObjectType.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\nexport interface BaseOsdkObjectType {\n $apiName: string;\n $primaryKey: string | number | boolean;\n\n [key: string]: string | number | boolean | undefined;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A simplified type safe version of `OntologyObjectV2` that adds a tiny bit
|
|
19
|
+
* more strictness in that it declares the meaning of values for the `__` prefix
|
|
20
|
+
* props.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Helpful for distinguishing between an object that looks like it is for the server (__apiName)
|
|
25
|
+
* vs one that is for the client ($apiName).
|
|
26
|
+
*/
|
|
27
|
+
export function isBaseServerObject(obj) {
|
|
28
|
+
return typeof obj === "object" && obj != null && "__primaryKey" in obj && "__apiName" in obj && !("$apiName" in obj) && !("$primaryKey" in obj);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=BaseServerObject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseServerObject.js","names":["isBaseServerObject","obj"],"sources":["BaseServerObject.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 * as OntologiesV2 from \"@osdk/foundry.ontologies\";\n\n/**\n * A simplified type safe version of `OntologyObjectV2` that adds a tiny bit\n * more strictness in that it declares the meaning of values for the `__` prefix\n * props.\n */\nexport interface BaseServerObject extends OntologiesV2.OntologyObjectV2 {\n __rid?: string;\n __primaryKey: string | number | boolean;\n __apiName: OntologiesV2.ObjectTypeApiName;\n __title?: string;\n\n [key: string]: unknown;\n}\n\n/**\n * Helpful for distinguishing between an object that looks like it is for the server (__apiName)\n * vs one that is for the client ($apiName).\n */\nexport function isBaseServerObject(obj: unknown): obj is BaseServerObject {\n return (\n typeof obj === \"object\"\n && obj != null\n && \"__primaryKey\" in obj\n && \"__apiName\" in obj\n && !(\"$apiName\" in obj)\n && !(\"$primaryKey\" in obj)\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA,OAAO,SAASA,kBAAkBA,CAACC,GAAY,EAA2B;EACxE,OACE,OAAOA,GAAG,KAAK,QAAQ,IACpBA,GAAG,IAAI,IAAI,IACX,cAAc,IAAIA,GAAG,IACrB,WAAW,IAAIA,GAAG,IAClB,EAAE,UAAU,IAAIA,GAAG,CAAC,IACpB,EAAE,aAAa,IAAIA,GAAG,CAAC;AAE9B","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FauxActionImpl.js","names":[],"sources":["FauxActionImpl.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 * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport type { FauxAttachmentStore } from \"./FauxAttachmentStore.js\";\nimport type { FauxDataStoreBatch } from \"./FauxDataStoreBatch.js\";\nimport type { TH_ApplyActionRequestV2 } from \"./typeHelpers/TH_ApplyActionRequestV2.js\";\n\nexport type FauxActionImpl<\n Q extends OntologiesV2.ActionTypeV2 = OntologiesV2.ActionTypeV2,\n> = (\n batch: FauxDataStoreBatch,\n payload: TH_ApplyActionRequestV2<Q>,\n ctx: {\n def: Q;\n attachments: FauxAttachmentStore;\n },\n) => unknown;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { OpenApiCallError } from "../handlers/util/handleOpenApiCall.js";
|
|
18
|
+
export class FauxAttachmentStore {
|
|
19
|
+
#attachments = new Map();
|
|
20
|
+
registerAttachment(attachment) {
|
|
21
|
+
this.#attachments.set(attachment.rid, attachment);
|
|
22
|
+
return this.getAttachmentMetadataByRid(attachment.rid);
|
|
23
|
+
}
|
|
24
|
+
getAttachmentMetadataByRid(attachmentRid) {
|
|
25
|
+
const attachment = this.#attachments.get(attachmentRid);
|
|
26
|
+
if (!attachment) {
|
|
27
|
+
throw new OpenApiCallError(404, {
|
|
28
|
+
errorCode: "NOT_FOUND",
|
|
29
|
+
errorName: "AttachmentNotFound",
|
|
30
|
+
errorInstanceId: "internal",
|
|
31
|
+
parameters: {
|
|
32
|
+
attachmentRid
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
const {
|
|
37
|
+
buffer,
|
|
38
|
+
...metadata
|
|
39
|
+
} = attachment;
|
|
40
|
+
return {
|
|
41
|
+
...metadata,
|
|
42
|
+
sizeBytes: String(buffer.byteLength)
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
getAttachmentBuffer(attachmentRid) {
|
|
46
|
+
const attachment = this.#attachments.get(attachmentRid);
|
|
47
|
+
if (!attachment) {
|
|
48
|
+
throw new OpenApiCallError(404, {
|
|
49
|
+
errorCode: "NOT_FOUND",
|
|
50
|
+
errorName: "AttachmentNotFound",
|
|
51
|
+
errorInstanceId: "internal",
|
|
52
|
+
parameters: {
|
|
53
|
+
attachmentRid
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return attachment.buffer;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=FauxAttachmentStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FauxAttachmentStore.js","names":["OpenApiCallError","FauxAttachmentStore","attachments","Map","registerAttachment","attachment","set","rid","getAttachmentMetadataByRid","attachmentRid","get","errorCode","errorName","errorInstanceId","parameters","buffer","metadata","sizeBytes","String","byteLength","getAttachmentBuffer"],"sources":["FauxAttachmentStore.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 * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport { OpenApiCallError } from \"../handlers/util/handleOpenApiCall.js\";\n\nexport interface FauxAttachmentInfo\n extends Omit<OntologiesV2.AttachmentV2, \"sizeBytes\">\n{\n buffer: ArrayBuffer;\n}\n\nexport class FauxAttachmentStore {\n #attachments = new Map<string, FauxAttachmentInfo>();\n\n registerAttachment(\n attachment: FauxAttachmentInfo,\n ): OntologiesV2.AttachmentV2 {\n this.#attachments.set(attachment.rid, attachment);\n return this.getAttachmentMetadataByRid(attachment.rid);\n }\n\n getAttachmentMetadataByRid(attachmentRid: string): OntologiesV2.AttachmentV2 {\n const attachment = this.#attachments.get(attachmentRid);\n if (!attachment) {\n throw new OpenApiCallError(\n 404,\n {\n errorCode: \"NOT_FOUND\",\n errorName: \"AttachmentNotFound\",\n errorInstanceId: \"internal\",\n parameters: { attachmentRid },\n } satisfies OntologiesV2.AttachmentNotFound,\n );\n }\n\n const { buffer, ...metadata } = attachment;\n\n return {\n ...metadata,\n sizeBytes: String(buffer.byteLength),\n };\n }\n\n getAttachmentBuffer(attachmentRid: string): ArrayBuffer {\n const attachment = this.#attachments.get(attachmentRid);\n if (!attachment) {\n throw new OpenApiCallError(\n 404,\n {\n errorCode: \"NOT_FOUND\",\n errorName: \"AttachmentNotFound\",\n errorInstanceId: \"internal\",\n parameters: { attachmentRid },\n } satisfies OntologiesV2.AttachmentNotFound,\n );\n }\n return attachment.buffer;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,gBAAgB,QAAQ,uCAAuC;AAQxE,OAAO,MAAMC,mBAAmB,CAAC;EAC/B,CAACC,WAAW,GAAG,IAAIC,GAAG,CAA6B,CAAC;EAEpDC,kBAAkBA,CAChBC,UAA8B,EACH;IAC3B,IAAI,CAAC,CAACH,WAAW,CAACI,GAAG,CAACD,UAAU,CAACE,GAAG,EAAEF,UAAU,CAAC;IACjD,OAAO,IAAI,CAACG,0BAA0B,CAACH,UAAU,CAACE,GAAG,CAAC;EACxD;EAEAC,0BAA0BA,CAACC,aAAqB,EAA6B;IAC3E,MAAMJ,UAAU,GAAG,IAAI,CAAC,CAACH,WAAW,CAACQ,GAAG,CAACD,aAAa,CAAC;IACvD,IAAI,CAACJ,UAAU,EAAE;MACf,MAAM,IAAIL,gBAAgB,CACxB,GAAG,EACH;QACEW,SAAS,EAAE,WAAW;QACtBC,SAAS,EAAE,oBAAoB;QAC/BC,eAAe,EAAE,UAAU;QAC3BC,UAAU,EAAE;UAAEL;QAAc;MAC9B,CACF,CAAC;IACH;IAEA,MAAM;MAAEM,MAAM;MAAE,GAAGC;IAAS,CAAC,GAAGX,UAAU;IAE1C,OAAO;MACL,GAAGW,QAAQ;MACXC,SAAS,EAAEC,MAAM,CAACH,MAAM,CAACI,UAAU;IACrC,CAAC;EACH;EAEAC,mBAAmBA,CAACX,aAAqB,EAAe;IACtD,MAAMJ,UAAU,GAAG,IAAI,CAAC,CAACH,WAAW,CAACQ,GAAG,CAACD,aAAa,CAAC;IACvD,IAAI,CAACJ,UAAU,EAAE;MACf,MAAM,IAAIL,gBAAgB,CACxB,GAAG,EACH;QACEW,SAAS,EAAE,WAAW;QACtBC,SAAS,EAAE,oBAAoB;QAC/BC,eAAe,EAAE,UAAU;QAC3BC,UAAU,EAAE;UAAEL;QAAc;MAC9B,CACF,CAAC;IACH;IACA,OAAOJ,UAAU,CAACU,MAAM;EAC1B;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,470 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { DefaultMap, MultiMap } from "mnemonist";
|
|
18
|
+
import { randomUUID } from "node:crypto";
|
|
19
|
+
import * as crypto from "node:crypto";
|
|
20
|
+
import invariant from "tiny-invariant";
|
|
21
|
+
import { InvalidRequest, ObjectNotFoundError } from "../errors.js";
|
|
22
|
+
import { subSelectProperties } from "../filterObjects.js";
|
|
23
|
+
import { getPaginationParamsFromRequest } from "../handlers/util/getPaginationParams.js";
|
|
24
|
+
import { OpenApiCallError } from "../handlers/util/handleOpenApiCall.js";
|
|
25
|
+
import { pageThroughResponseSearchParams } from "../handlers/util/pageThroughResponseSearchParams.js";
|
|
26
|
+
import { isBaseServerObject } from "./BaseServerObject.js";
|
|
27
|
+
import { FauxDataStoreBatch } from "./FauxDataStoreBatch.js";
|
|
28
|
+
import { filterTimeSeriesData } from "./filterTimeSeriesData.js";
|
|
29
|
+
import { createOrderBySortFn, getObjectsFromSet } from "./getObjectsFromSet.js";
|
|
30
|
+
import { objectLocator, parseLocator } from "./ObjectLocator.js";
|
|
31
|
+
import { validateAction } from "./validateAction.js";
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Represents the properties needed to create an object, specifically,
|
|
35
|
+
* the properties of the object and the $apiName
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Helper type for converting `foo: string | undefined` into `foo?: string`
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Type safe object for representing "client" side objects.
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
export class FauxDataStore {
|
|
47
|
+
#objects = new DefaultMap(() => new Map());
|
|
48
|
+
#singleLinks = new DefaultMap(() => new Map());
|
|
49
|
+
#manyLinks = new DefaultMap(() => new MultiMap(Set));
|
|
50
|
+
#fauxOntology;
|
|
51
|
+
#attachments;
|
|
52
|
+
#timeSeriesData = new DefaultMap(() => new DefaultMap(() => new DefaultMap(() => [])));
|
|
53
|
+
#media = new DefaultMap(() => new DefaultMap(() => {
|
|
54
|
+
return new Map();
|
|
55
|
+
}));
|
|
56
|
+
constructor(fauxOntology, attachments) {
|
|
57
|
+
this.#fauxOntology = fauxOntology;
|
|
58
|
+
this.#attachments = attachments;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Removes all data that is associated with a namespace/ontology.
|
|
63
|
+
*
|
|
64
|
+
* Note: does not clear `attachments` nor does it clear the ontology itself.
|
|
65
|
+
*/
|
|
66
|
+
clear() {
|
|
67
|
+
this.#media.clear();
|
|
68
|
+
this.#timeSeriesData.clear();
|
|
69
|
+
this.#manyLinks.clear();
|
|
70
|
+
this.#singleLinks.clear();
|
|
71
|
+
this.#objects.clear();
|
|
72
|
+
}
|
|
73
|
+
get ontology() {
|
|
74
|
+
return this.#fauxOntology;
|
|
75
|
+
}
|
|
76
|
+
#assertObjectExists(objectType, primaryKey) {
|
|
77
|
+
if (!this.getObject(objectType, primaryKey)) {
|
|
78
|
+
throw new OpenApiCallError(404, ObjectNotFoundError(objectType, String(primaryKey)));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
#assertObjectDoesNotExist(objectType, primaryKey) {
|
|
82
|
+
if (this.getObject(objectType, primaryKey)) {
|
|
83
|
+
throw new OpenApiCallError(500, {
|
|
84
|
+
errorCode: "CONFLICT",
|
|
85
|
+
errorName: "ObjectAlreadyExists",
|
|
86
|
+
errorInstanceId: "faux-foundry",
|
|
87
|
+
parameters: {
|
|
88
|
+
objectType,
|
|
89
|
+
primaryKey: String(primaryKey)
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Version for use in places like @osdk/client.
|
|
97
|
+
*
|
|
98
|
+
* @param obj An `Osdk.Instance` like object for the ObjectType in the generics
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Version of register object generally used in shared.test
|
|
103
|
+
* @param obj A raw server side representation of an object
|
|
104
|
+
*
|
|
105
|
+
* Don't use, its too easy to end up with an any.
|
|
106
|
+
*/
|
|
107
|
+
|
|
108
|
+
registerObject(objectType, anyObj) {
|
|
109
|
+
let bso;
|
|
110
|
+
// obj = { ...obj }; // make a copy so we can mutate it
|
|
111
|
+
|
|
112
|
+
if (isBaseServerObject(objectType)) {
|
|
113
|
+
!(anyObj == null) ? process.env.NODE_ENV !== "production" ? invariant(false, "Internal overload should only pass one argument") : invariant(false) : void 0;
|
|
114
|
+
!!Object.keys(objectType).some(s => s.startsWith("$")) ? process.env.NODE_ENV !== "production" ? invariant(false, "Object should not have any keys starting with $ if it has __apiName") : invariant(false) : void 0;
|
|
115
|
+
bso = objectType;
|
|
116
|
+
} else if (anyObj == null) {
|
|
117
|
+
process.env.NODE_ENV !== "production" ? invariant(false, "should not be possible due to overloads") : invariant(false);
|
|
118
|
+
} else if (isBaseServerObject(anyObj)) {
|
|
119
|
+
!!Object.keys(anyObj).some(s => s.startsWith("$")) ? process.env.NODE_ENV !== "production" ? invariant(false, "Object should not have any keys starting with $ if it has __apiName") : invariant(false) : void 0;
|
|
120
|
+
bso = anyObj;
|
|
121
|
+
} else {
|
|
122
|
+
bso = this.#osdkCreatableToBso(objectType, anyObj);
|
|
123
|
+
}
|
|
124
|
+
const apiName = bso.__apiName || bso.$apiName;
|
|
125
|
+
!apiName ? process.env.NODE_ENV !== "production" ? invariant(false, "Object should have an __apiName or $apiName") : invariant(false) : void 0;
|
|
126
|
+
this.#assertObjectDoesNotExist(apiName, bso.__primaryKey);
|
|
127
|
+
if (!("__apiName" in bso && "__primaryKey" in bso)) {
|
|
128
|
+
!("$apiName" in bso && "$primaryKey" in bso) ? process.env.NODE_ENV !== "production" ? invariant(false, "Object should have (__apiName and __primaryKey) or ($apiName and $primaryKey)") : invariant(false) : void 0;
|
|
129
|
+
const {
|
|
130
|
+
$apiName,
|
|
131
|
+
$primaryKey,
|
|
132
|
+
...others
|
|
133
|
+
} = bso;
|
|
134
|
+
bso = {
|
|
135
|
+
__apiName: $apiName,
|
|
136
|
+
__primaryKey: $primaryKey,
|
|
137
|
+
...others
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
this.#assertObjectDoesNotExist(bso.__apiName, bso.__primaryKey);
|
|
141
|
+
this.#objects.get(bso.__apiName).set(String(bso.__primaryKey), Object.freeze({
|
|
142
|
+
...bso
|
|
143
|
+
}));
|
|
144
|
+
}
|
|
145
|
+
#osdkCreatableToBso(objectType, anyObj) {
|
|
146
|
+
objectType = typeof objectType === "string" ? objectType : objectType.apiName;
|
|
147
|
+
if ("$apiName" in anyObj) {
|
|
148
|
+
!(anyObj.$apiName === objectType) ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
|
|
149
|
+
}
|
|
150
|
+
const {
|
|
151
|
+
$apiName,
|
|
152
|
+
$primaryKey,
|
|
153
|
+
...others
|
|
154
|
+
} = anyObj;
|
|
155
|
+
const meta = this.ontology.getObjectTypeFullMetadataOrThrow(objectType);
|
|
156
|
+
const realPrimaryKey = anyObj[meta.objectType.primaryKey];
|
|
157
|
+
const maybeTitle = anyObj[meta.objectType.titleProperty];
|
|
158
|
+
const rid = anyObj.$rid ?? `ri.phonograph2-objects.main.object.${crypto.randomUUID()}`;
|
|
159
|
+
!(realPrimaryKey != null) ? process.env.NODE_ENV !== "production" ? invariant(false, `Object should have a primary key. ${JSON.stringify(anyObj)}`) : invariant(false) : void 0;
|
|
160
|
+
!($primaryKey == null || $primaryKey === realPrimaryKey) ? process.env.NODE_ENV !== "production" ? invariant(false, "Primary key mismatch") : invariant(false) : void 0;
|
|
161
|
+
return {
|
|
162
|
+
__apiName: objectType,
|
|
163
|
+
__primaryKey: realPrimaryKey,
|
|
164
|
+
__title: maybeTitle ? String(maybeTitle) : undefined,
|
|
165
|
+
__rid: rid,
|
|
166
|
+
...others
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
replaceObjectOrThrow(x) {
|
|
170
|
+
this.#assertObjectExists(x.__apiName, x.__primaryKey);
|
|
171
|
+
this.#objects.get(x.__apiName).set(String(x.__primaryKey), x);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** Throws if the object does not already exist */
|
|
175
|
+
unregisterObjectOrThrow(objectType, primaryKey) {
|
|
176
|
+
this.#assertObjectExists(objectType, primaryKey);
|
|
177
|
+
this.#objects.get(objectType).delete(String(primaryKey));
|
|
178
|
+
}
|
|
179
|
+
registerLink(src, srcLinkName, dst, destLinkName) {
|
|
180
|
+
const srcLocator = objectLocator(src);
|
|
181
|
+
const dstLocator = objectLocator(dst);
|
|
182
|
+
const [srcSide, dstSide] = this.#fauxOntology.getBothLinkTypeSides(src.__apiName, srcLinkName, dst.__apiName);
|
|
183
|
+
!(srcSide.linkTypeRid === dstSide.linkTypeRid) ? process.env.NODE_ENV !== "production" ? invariant(false, `Expected both sides of the link to have the same rid, but got ${srcSide.linkTypeRid} and ${dstSide.linkTypeRid}`) : invariant(false) : void 0;
|
|
184
|
+
!(dstSide.apiName === destLinkName) ? process.env.NODE_ENV !== "production" ? invariant(false, `Link name mismatch on dst side. Expected ${destLinkName} but found ${dstSide.apiName}`) : invariant(false) : void 0;
|
|
185
|
+
this.#updateSingleLinkSide(srcSide, srcLocator, dstSide, dstLocator);
|
|
186
|
+
this.#updateSingleLinkSide(dstSide, dstLocator, srcSide, srcLocator);
|
|
187
|
+
}
|
|
188
|
+
unregisterLink(src, srcLinkName, dst, dstLinkName) {
|
|
189
|
+
const srcLocator = objectLocator(src);
|
|
190
|
+
const dstLocator = objectLocator(dst);
|
|
191
|
+
const [srcSide, dstSide] = this.#fauxOntology.getBothLinkTypeSides(src.__apiName, srcLinkName, dst.__apiName);
|
|
192
|
+
!(dstSide.apiName === dstLinkName) ? process.env.NODE_ENV !== "production" ? invariant(false, `Link name mismatch on dst side. Expected ${dstLinkName} but found ${dstSide.apiName}`) : invariant(false) : void 0;
|
|
193
|
+
this.#removeSingleSideOfLink(srcLocator, srcSide, dstLocator);
|
|
194
|
+
this.#removeSingleSideOfLink(dstLocator, dstSide, srcLocator);
|
|
195
|
+
}
|
|
196
|
+
registerTimeSeriesData(objectType, primaryKey, property, data) {
|
|
197
|
+
this.getObjectOrThrow(objectType, primaryKey);
|
|
198
|
+
const def = this.ontology.getObjectTypeFullMetadataOrThrow(objectType);
|
|
199
|
+
!(def.objectType.properties[property].dataType.type === "timeseries" || def.objectType.properties[property].dataType.type === "geotimeSeriesReference") ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
|
|
200
|
+
this.#timeSeriesData.get(objectType).get(String(primaryKey)).set(property, data);
|
|
201
|
+
}
|
|
202
|
+
getTimeSeriesData(objectType, primaryKey, property, filter) {
|
|
203
|
+
this.getObjectOrThrow(objectType, primaryKey);
|
|
204
|
+
const allData = this.#timeSeriesData.get(objectType).get(String(primaryKey)).get(property);
|
|
205
|
+
if (!filter) return allData;
|
|
206
|
+
return filterTimeSeriesData(allData, filter);
|
|
207
|
+
}
|
|
208
|
+
#updateSingleLinkSide(srcSide, srcLocator, dstSide, dstLocator) {
|
|
209
|
+
const srcLinkName = srcSide.apiName;
|
|
210
|
+
if (srcSide.cardinality === "ONE") {
|
|
211
|
+
const linkNameToObj = this.#singleLinks.get(srcLocator);
|
|
212
|
+
const oldLocator = linkNameToObj.get(srcLinkName);
|
|
213
|
+
if (oldLocator && oldLocator !== dstLocator) {
|
|
214
|
+
// we need to remove the other side's old value
|
|
215
|
+
this.#removeSingleSideOfLink(oldLocator, dstSide, srcLocator);
|
|
216
|
+
}
|
|
217
|
+
linkNameToObj.set(srcLinkName, dstLocator);
|
|
218
|
+
} else if (srcSide.cardinality === "MANY") {
|
|
219
|
+
const linkNameToObj = this.#manyLinks.get(srcLocator);
|
|
220
|
+
linkNameToObj.set(srcLinkName, dstLocator);
|
|
221
|
+
} else {
|
|
222
|
+
// "never" case
|
|
223
|
+
throw new Error("unexpected cardinality: " + srcSide.cardinality);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
registerMedia(objectType, property, content, mediaType, path,
|
|
227
|
+
// This should be the correct prefix, per
|
|
228
|
+
// https://github.com/palantir/osdk-ts/pull/1303#discussion_r2001989395
|
|
229
|
+
mediaItemRid = `ri.mio.main.media-item.${randomUUID()}`) {
|
|
230
|
+
const mediaRef = Object.freeze({
|
|
231
|
+
mimeType: mediaType,
|
|
232
|
+
reference: Object.freeze({
|
|
233
|
+
type: "mediaSetViewItem",
|
|
234
|
+
mediaSetViewItem: Object.freeze({
|
|
235
|
+
mediaItemRid,
|
|
236
|
+
mediaSetRid: "ri.unimplemented.in.shared.test",
|
|
237
|
+
mediaSetViewRid: "ri.unimplemented.in.shared.test"
|
|
238
|
+
})
|
|
239
|
+
})
|
|
240
|
+
});
|
|
241
|
+
this.#media.get(objectType).get(property).set(mediaItemRid, Object.freeze({
|
|
242
|
+
content,
|
|
243
|
+
mediaRef,
|
|
244
|
+
metaData: Object.freeze({
|
|
245
|
+
mediaType,
|
|
246
|
+
path,
|
|
247
|
+
sizeBytes: String(content.byteLength)
|
|
248
|
+
})
|
|
249
|
+
}));
|
|
250
|
+
return mediaRef;
|
|
251
|
+
}
|
|
252
|
+
getMediaOrThrow(objectType, primaryKey, property) {
|
|
253
|
+
const obj = this.getObjectOrThrow(objectType, primaryKey);
|
|
254
|
+
const propertyDef = this.ontology.getObjectTypeFullMetadataOrThrow(objectType).objectType.properties[property];
|
|
255
|
+
if (!propertyDef) {
|
|
256
|
+
// This should be the correct error, per
|
|
257
|
+
// https://github.com/palantir/osdk-ts/pull/1303#discussion_r2001968959
|
|
258
|
+
throw new OpenApiCallError(400, {
|
|
259
|
+
errorCode: "NOT_FOUND",
|
|
260
|
+
errorName: "PropertiesNotFound",
|
|
261
|
+
errorInstanceId: "faux-foundry",
|
|
262
|
+
parameters: {
|
|
263
|
+
objectType,
|
|
264
|
+
properties: [property]
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
if (propertyDef.dataType.type !== "mediaReference") {
|
|
269
|
+
// FIXME: what would the backend do here?
|
|
270
|
+
throw new OpenApiCallError(400, {
|
|
271
|
+
errorCode: "INVALID_ARGUMENT",
|
|
272
|
+
errorName: "InvalidPropertyType",
|
|
273
|
+
errorInstanceId: "faux-foundry",
|
|
274
|
+
parameters: {
|
|
275
|
+
property,
|
|
276
|
+
propertyBaseType: propertyDef.dataType.type
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
const rid = obj[property].reference.mediaSetViewItem.mediaItemRid;
|
|
281
|
+
if (!rid || !rid.startsWith("ri.")) {
|
|
282
|
+
throw new OpenApiCallError(400, {
|
|
283
|
+
errorCode: "INVALID_ARGUMENT",
|
|
284
|
+
errorName: "InvalidPropertyValue",
|
|
285
|
+
errorInstanceId: "faux-foundry",
|
|
286
|
+
parameters: {
|
|
287
|
+
property,
|
|
288
|
+
propertyBaseType: propertyDef.dataType.type,
|
|
289
|
+
propertyValue: rid
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
const ret = this.#media.get(objectType).get(property).get(rid);
|
|
294
|
+
if (!ret) {
|
|
295
|
+
throw new OpenApiCallError(400, InvalidRequest("Invalid parameters"));
|
|
296
|
+
}
|
|
297
|
+
return ret;
|
|
298
|
+
}
|
|
299
|
+
#removeSingleSideOfLink(locator, linkSide, expectedPriorValue) {
|
|
300
|
+
const destLinkName = linkSide.apiName;
|
|
301
|
+
if (linkSide.cardinality === "ONE") {
|
|
302
|
+
const links = this.#singleLinks.get(locator);
|
|
303
|
+
!(links.get(destLinkName) === expectedPriorValue) ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
|
|
304
|
+
links.delete(destLinkName);
|
|
305
|
+
} else {
|
|
306
|
+
const links = this.#manyLinks.get(locator);
|
|
307
|
+
!links.get(destLinkName)?.has(expectedPriorValue) ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
|
|
308
|
+
links.remove(destLinkName, expectedPriorValue);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
getObject(apiName, primaryKey) {
|
|
312
|
+
return this.#objects.get(apiName).get(String(primaryKey));
|
|
313
|
+
}
|
|
314
|
+
getObjectOrThrow(apiName, primaryKey) {
|
|
315
|
+
const object = this.getObject(apiName, primaryKey);
|
|
316
|
+
if (!object) {
|
|
317
|
+
throw new OpenApiCallError(404, ObjectNotFoundError(apiName, String(primaryKey)));
|
|
318
|
+
}
|
|
319
|
+
return object;
|
|
320
|
+
}
|
|
321
|
+
getObjectByRid(rid) {
|
|
322
|
+
for (const [, pkToObjects] of this.#objects) {
|
|
323
|
+
for (const [, obj] of pkToObjects) {
|
|
324
|
+
if (obj.__rid === rid) {
|
|
325
|
+
return obj;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
getLinksOrThrow(apiName, primaryKey, linkApiName) {
|
|
331
|
+
const object = this.getObjectOrThrow(apiName, primaryKey);
|
|
332
|
+
const linkTypeSide = this.#fauxOntology.getLinkTypeSideV2(apiName, linkApiName);
|
|
333
|
+
if (linkTypeSide.cardinality === "ONE") {
|
|
334
|
+
const locator = this.#singleLinks.get(objectLocator(object)).get(linkApiName);
|
|
335
|
+
if (locator === undefined) {
|
|
336
|
+
return [];
|
|
337
|
+
}
|
|
338
|
+
const {
|
|
339
|
+
objectType,
|
|
340
|
+
primaryKey
|
|
341
|
+
} = parseLocator(locator);
|
|
342
|
+
return [this.getObjectOrThrow(objectType, primaryKey)]; // will throw if not found
|
|
343
|
+
} else {
|
|
344
|
+
const locators = this.#manyLinks.get(objectLocator(object)).get(linkApiName);
|
|
345
|
+
return Array.from(locators ?? []).map(a => {
|
|
346
|
+
const [objectType, primaryKey] = a.split(":") ?? [];
|
|
347
|
+
!(objectType && primaryKey) ? process.env.NODE_ENV !== "production" ? invariant(false, "Invalid locator format") : invariant(false) : void 0;
|
|
348
|
+
return this.getObjectOrThrow(objectType, primaryKey);
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
getLinkOrThrow(objectType, primaryKey, linkType, targetPrimaryKey) {
|
|
353
|
+
const allLinks = this.getLinksOrThrow(objectType, primaryKey, linkType);
|
|
354
|
+
const object = allLinks.filter(l => String(l.__primaryKey) === targetPrimaryKey)[0];
|
|
355
|
+
if (!object) {
|
|
356
|
+
throw new OpenApiCallError(404, ObjectNotFoundError(`${objectType} -> ${linkType}`, String(targetPrimaryKey)));
|
|
357
|
+
}
|
|
358
|
+
return object;
|
|
359
|
+
}
|
|
360
|
+
getObjectsOfType(apiName) {
|
|
361
|
+
return this.#objects.get(apiName).values();
|
|
362
|
+
}
|
|
363
|
+
getObjectsFromObjectSet(parsedBody) {
|
|
364
|
+
const selected = parsedBody.select;
|
|
365
|
+
// when we have interfaces in here, we have a little trick for
|
|
366
|
+
// caching off the important properties
|
|
367
|
+
let objects = getObjectsFromSet(this, parsedBody.objectSet, undefined);
|
|
368
|
+
if (!objects) {
|
|
369
|
+
return {
|
|
370
|
+
data: [],
|
|
371
|
+
totalCount: "0",
|
|
372
|
+
nextPageToken: undefined
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
if (parsedBody.orderBy) {
|
|
376
|
+
objects = objects.sort(createOrderBySortFn(parsedBody.orderBy));
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// finally, if we got interfaces, the objects have names like the interface and we need
|
|
380
|
+
// to return them like the object.
|
|
381
|
+
|
|
382
|
+
const page = pageThroughResponseSearchParams(objects, getPaginationParamsFromRequest(parsedBody), false);
|
|
383
|
+
if (!page) {
|
|
384
|
+
throw new OpenApiCallError(404, InvalidRequest(`No objects found for ${JSON.stringify(parsedBody)}`));
|
|
385
|
+
}
|
|
386
|
+
const ret = subSelectProperties(page, [...selected], true, parsedBody.excludeRid);
|
|
387
|
+
return ret;
|
|
388
|
+
}
|
|
389
|
+
getAttachmentMetadata(objectType, primaryKey, propertyName) {
|
|
390
|
+
const rid = this.getObjectOrThrow(objectType, primaryKey)[propertyName];
|
|
391
|
+
return this.#attachments.getAttachmentMetadataByRid(rid);
|
|
392
|
+
}
|
|
393
|
+
getAttachmentBuffer(objectType, primaryKey, propertyName) {
|
|
394
|
+
const rid = this.getObjectOrThrow(objectType, primaryKey)[propertyName];
|
|
395
|
+
return this.#attachments.getAttachmentBuffer(rid);
|
|
396
|
+
}
|
|
397
|
+
applyAction(actionTypeApiName, req) {
|
|
398
|
+
const actionDef = this.#fauxOntology.getActionDef(actionTypeApiName);
|
|
399
|
+
const actionImpl = this.#fauxOntology.getActionImpl(actionTypeApiName);
|
|
400
|
+
const validation = validateAction(req, actionDef, this);
|
|
401
|
+
if (validation.result === "INVALID") {
|
|
402
|
+
return {
|
|
403
|
+
validation
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
const batch = new FauxDataStoreBatch(this);
|
|
407
|
+
const r = actionImpl(batch, req, {
|
|
408
|
+
def: actionDef,
|
|
409
|
+
attachments: this.#attachments
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
// The legacy actions return the full payload
|
|
413
|
+
// they want to return, so we need to do that
|
|
414
|
+
// but the future is for the actionImpl's to
|
|
415
|
+
// return void and to do validation details here
|
|
416
|
+
if (r) return r;
|
|
417
|
+
return {
|
|
418
|
+
validation: {
|
|
419
|
+
parameters: {},
|
|
420
|
+
result: "VALID",
|
|
421
|
+
submissionCriteria: []
|
|
422
|
+
},
|
|
423
|
+
edits: req.options?.mode === "VALIDATE_AND_EXECUTE" && (req.options.returnEdits === "ALL" || req.options.returnEdits === "ALL_V2_WITH_DELETIONS") ? {
|
|
424
|
+
type: "edits",
|
|
425
|
+
...batch.objectEdits
|
|
426
|
+
} : undefined
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
batchApplyAction(actionTypeApiName, batchReq) {
|
|
430
|
+
const actionDef = this.#fauxOntology.getActionDef(actionTypeApiName);
|
|
431
|
+
const actionImpl = this.#fauxOntology.getActionImpl(actionTypeApiName);
|
|
432
|
+
for (const req of batchReq.requests) {
|
|
433
|
+
const result = validateAction(req, actionDef, this);
|
|
434
|
+
if (result.result === "INVALID") {
|
|
435
|
+
throw new OpenApiCallError(500, {
|
|
436
|
+
errorCode: "INVALID_ARGUMENT",
|
|
437
|
+
errorName: "ActionValidationFailed",
|
|
438
|
+
errorInstanceId: "faux-foundry",
|
|
439
|
+
parameters: {
|
|
440
|
+
actionType: actionTypeApiName
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
const batch = new FauxDataStoreBatch(this);
|
|
446
|
+
for (const item of batchReq.requests) {
|
|
447
|
+
actionImpl(batch, {
|
|
448
|
+
...item,
|
|
449
|
+
options: {
|
|
450
|
+
mode: "VALIDATE_AND_EXECUTE",
|
|
451
|
+
returnEdits: batchReq.options?.returnEdits
|
|
452
|
+
}
|
|
453
|
+
}, {
|
|
454
|
+
def: actionDef,
|
|
455
|
+
attachments: this.#attachments
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
if (batchReq.options?.returnEdits === "NONE") {
|
|
459
|
+
return {};
|
|
460
|
+
}
|
|
461
|
+
return {
|
|
462
|
+
edits: {
|
|
463
|
+
type: "edits",
|
|
464
|
+
...batch.objectEdits,
|
|
465
|
+
edits: batch.objectEdits.edits.filter(x => x.type !== "deleteObject" && x.type !== "deleteLink")
|
|
466
|
+
}
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
//# sourceMappingURL=FauxDataStore.js.map
|