@osdk/faux 0.2.0-rc.19 → 0.3.0-beta.2
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 +10 -11
- package/build/browser/FauxFoundry/FauxDataStore.js +14 -9
- package/build/browser/FauxFoundry/FauxDataStore.js.map +1 -1
- package/build/browser/FauxFoundry/FauxDataStore.test.js +255 -1
- package/build/browser/FauxFoundry/FauxDataStore.test.js.map +1 -1
- package/build/browser/mock/OntologiesV2/Transactions.js +20 -0
- package/build/browser/mock/OntologiesV2/Transactions.js.map +1 -0
- package/build/browser/mock/OntologiesV2/index.js +1 -0
- package/build/browser/mock/OntologiesV2/index.js.map +1 -1
- package/build/cjs/index.cjs +48 -25
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +11 -4
- package/build/esm/FauxFoundry/FauxDataStore.js +14 -9
- package/build/esm/FauxFoundry/FauxDataStore.js.map +1 -1
- package/build/esm/FauxFoundry/FauxDataStore.test.js +255 -1
- package/build/esm/FauxFoundry/FauxDataStore.test.js.map +1 -1
- package/build/esm/mock/OntologiesV2/Transactions.js +20 -0
- package/build/esm/mock/OntologiesV2/Transactions.js.map +1 -0
- package/build/esm/mock/OntologiesV2/index.js +1 -0
- package/build/esm/mock/OntologiesV2/index.js.map +1 -1
- package/build/types/FauxFoundry/FauxDataStore.d.ts +2 -2
- package/build/types/FauxFoundry/FauxDataStore.d.ts.map +1 -1
- package/build/types/mock/OntologiesV2/Transactions.d.ts +3 -0
- package/build/types/mock/OntologiesV2/Transactions.d.ts.map +1 -0
- package/build/types/mock/OntologiesV2/index.d.ts +1 -0
- package/build/types/mock/OntologiesV2/index.d.ts.map +1 -1
- package/package.json +9 -9
package/build/cjs/index.cjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var generatorConverters = require('@osdk/generator-converters');
|
|
4
4
|
var crypto = require('crypto');
|
|
5
5
|
var mnemonist = require('mnemonist');
|
|
6
|
+
var util = require('util');
|
|
6
7
|
var invariant4 = require('tiny-invariant');
|
|
7
8
|
var msw = require('msw');
|
|
8
9
|
var deepEqual = require('fast-deep-equal');
|
|
@@ -1223,9 +1224,11 @@ var FauxDataStore = class {
|
|
|
1223
1224
|
};
|
|
1224
1225
|
}
|
|
1225
1226
|
this.#assertObjectDoesNotExist(bso.__apiName, bso.__primaryKey);
|
|
1226
|
-
|
|
1227
|
+
const frozenBso = Object.freeze({
|
|
1227
1228
|
...bso
|
|
1228
|
-
})
|
|
1229
|
+
});
|
|
1230
|
+
this.#objects.get(bso.__apiName).set(String(bso.__primaryKey), frozenBso);
|
|
1231
|
+
return frozenBso;
|
|
1229
1232
|
}
|
|
1230
1233
|
#osdkCreatableToBso(objectType, anyObj) {
|
|
1231
1234
|
objectType = typeof objectType === "string" ? objectType : objectType.apiName;
|
|
@@ -1258,17 +1261,19 @@ var FauxDataStore = class {
|
|
|
1258
1261
|
const linksToRemove = [];
|
|
1259
1262
|
for (const linkDef of objectType.linkTypes) {
|
|
1260
1263
|
if (linkDef.cardinality === "ONE") {
|
|
1261
|
-
!(this.#strict && linkDef.foreignKeyPropertyApiName) ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, `Error examining ${objectType.objectType.apiName}.${linkDef.apiName}: ONE side of links should have a foreign key.
|
|
1264
|
+
!(this.#strict && linkDef.foreignKeyPropertyApiName) ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, `Error examining ${objectType.objectType.apiName}.${linkDef.apiName}: ONE side of links should have a foreign key. ${util.inspect(linkDef, {
|
|
1265
|
+
colors: false
|
|
1266
|
+
})}`) : invariant4__default.default(false) : void 0;
|
|
1262
1267
|
const fkName = linkDef.foreignKeyPropertyApiName;
|
|
1263
1268
|
const fkValue = x[fkName];
|
|
1264
1269
|
const oldFkValue = oldObject[fkName];
|
|
1265
1270
|
if (oldObject[fkName] !== x[fkName]) {
|
|
1266
1271
|
const dstSide = this.ontology.getOtherLinkTypeSideV2OrThrow(objectType.objectType.apiName, linkDef.apiName);
|
|
1267
1272
|
const dstLocator = objectLocator({
|
|
1268
|
-
__apiName:
|
|
1273
|
+
__apiName: linkDef.objectTypeApiName,
|
|
1269
1274
|
__primaryKey: fkValue
|
|
1270
1275
|
});
|
|
1271
|
-
const target = this.getObject(
|
|
1276
|
+
const target = this.getObject(linkDef.objectTypeApiName, fkValue);
|
|
1272
1277
|
if (fkValue != null && !target) {
|
|
1273
1278
|
console.log(`WARNING! Setting a FK value to a non-existent object: ${dstLocator}`);
|
|
1274
1279
|
}
|
|
@@ -1284,7 +1289,7 @@ var FauxDataStore = class {
|
|
|
1284
1289
|
srcLocator: objectLocator(x),
|
|
1285
1290
|
srcSide: linkDef,
|
|
1286
1291
|
dstLocator: objectLocator({
|
|
1287
|
-
__apiName:
|
|
1292
|
+
__apiName: linkDef.objectTypeApiName,
|
|
1288
1293
|
__primaryKey: oldFkValue
|
|
1289
1294
|
}),
|
|
1290
1295
|
dstSide
|
|
@@ -1472,11 +1477,11 @@ var FauxDataStore = class {
|
|
|
1472
1477
|
const destLinkName = linkSide.apiName;
|
|
1473
1478
|
if (linkSide.cardinality === "ONE") {
|
|
1474
1479
|
const links = this.#singleLinks.get(locator);
|
|
1475
|
-
!(links.get(destLinkName) === expectedPriorValue) ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false) : invariant4__default.default(false) : void 0;
|
|
1480
|
+
!(links.get(destLinkName) === expectedPriorValue) ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, `Failed to remove link: expected ${JSON.stringify(expectedPriorValue)} but found ${JSON.stringify(links.get(destLinkName))} for link ${destLinkName} on ${JSON.stringify(locator)}`) : invariant4__default.default(false) : void 0;
|
|
1476
1481
|
links.delete(destLinkName);
|
|
1477
1482
|
} else {
|
|
1478
1483
|
const links = this.#manyLinks.get(locator);
|
|
1479
|
-
!links.get(destLinkName)?.has(expectedPriorValue) ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false) : invariant4__default.default(false) : void 0;
|
|
1484
|
+
!links.get(destLinkName)?.has(expectedPriorValue) ? process.env.NODE_ENV !== "production" ? invariant4__default.default(false, `Failed to remove link: expected collection to contain ${JSON.stringify(expectedPriorValue)} for link ${destLinkName} on ${JSON.stringify(locator)}`) : invariant4__default.default(false) : void 0;
|
|
1480
1485
|
links.remove(destLinkName, expectedPriorValue);
|
|
1481
1486
|
}
|
|
1482
1487
|
}
|
|
@@ -1664,6 +1669,7 @@ __export(OntologiesV2_exports2, {
|
|
|
1664
1669
|
OntologyInterfaces: () => OntologyInterfaces_exports,
|
|
1665
1670
|
OntologyObjectSets: () => OntologyObjectSets_exports,
|
|
1666
1671
|
OntologyObjectsV2: () => OntologyObjectsV2_exports,
|
|
1672
|
+
OntologyTransactions: () => Transactions_exports,
|
|
1667
1673
|
Queries: () => Queries_exports,
|
|
1668
1674
|
QueryTypes: () => QueryTypes_exports,
|
|
1669
1675
|
TimeSeriesPropertiesV2: () => TimeSeriesPropertiesV2_exports,
|
|
@@ -1677,7 +1683,7 @@ __export(Actions_exports, {
|
|
|
1677
1683
|
applyBatch: () => applyBatch2
|
|
1678
1684
|
});
|
|
1679
1685
|
|
|
1680
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
1686
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.26.0/node_modules/@osdk/foundry.ontologies/build/esm/public/Action.js
|
|
1681
1687
|
var Action_exports = {};
|
|
1682
1688
|
__export(Action_exports, {
|
|
1683
1689
|
apply: () => apply,
|
|
@@ -1784,7 +1790,7 @@ function parseUrl(baseUrl, endpointPath) {
|
|
|
1784
1790
|
return new URL(`api${endpointPath}`, baseUrl);
|
|
1785
1791
|
}
|
|
1786
1792
|
|
|
1787
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
1793
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.26.0/node_modules/@osdk/foundry.ontologies/build/esm/public/Action.js
|
|
1788
1794
|
var _apply = [1, "/v2/ontologies/{0}/actions/{1}/apply", 3];
|
|
1789
1795
|
function apply($ctx, ...args) {
|
|
1790
1796
|
return foundryPlatformFetch($ctx, _apply, ...args);
|
|
@@ -1798,7 +1804,7 @@ function applyBatch($ctx, ...args) {
|
|
|
1798
1804
|
return foundryPlatformFetch($ctx, _applyBatch, ...args);
|
|
1799
1805
|
}
|
|
1800
1806
|
|
|
1801
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
1807
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.26.0/node_modules/@osdk/foundry.ontologies/build/esm/public/ActionTypeV2.js
|
|
1802
1808
|
var ActionTypeV2_exports = {};
|
|
1803
1809
|
__export(ActionTypeV2_exports, {
|
|
1804
1810
|
get: () => get,
|
|
@@ -1818,7 +1824,7 @@ function getByRid($ctx, ...args) {
|
|
|
1818
1824
|
return foundryPlatformFetch($ctx, _getByRid, ...args);
|
|
1819
1825
|
}
|
|
1820
1826
|
|
|
1821
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
1827
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.26.0/node_modules/@osdk/foundry.ontologies/build/esm/public/Attachment.js
|
|
1822
1828
|
var Attachment_exports = {};
|
|
1823
1829
|
__export(Attachment_exports, {
|
|
1824
1830
|
get: () => get2,
|
|
@@ -1843,7 +1849,7 @@ function get2($ctx, ...args) {
|
|
|
1843
1849
|
return foundryPlatformFetch($ctx, _get2, ...args);
|
|
1844
1850
|
}
|
|
1845
1851
|
|
|
1846
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
1852
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.26.0/node_modules/@osdk/foundry.ontologies/build/esm/public/AttachmentPropertyV2.js
|
|
1847
1853
|
var AttachmentPropertyV2_exports = {};
|
|
1848
1854
|
__export(AttachmentPropertyV2_exports, {
|
|
1849
1855
|
getAttachment: () => getAttachment,
|
|
@@ -1868,7 +1874,7 @@ function readAttachmentByRid($ctx, ...args) {
|
|
|
1868
1874
|
return foundryPlatformFetch($ctx, _readAttachmentByRid, ...args);
|
|
1869
1875
|
}
|
|
1870
1876
|
|
|
1871
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
1877
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.26.0/node_modules/@osdk/foundry.ontologies/build/esm/public/LinkedObjectV2.js
|
|
1872
1878
|
var LinkedObjectV2_exports = {};
|
|
1873
1879
|
__export(LinkedObjectV2_exports, {
|
|
1874
1880
|
getLinkedObject: () => getLinkedObject,
|
|
@@ -1883,7 +1889,7 @@ function getLinkedObject($ctx, ...args) {
|
|
|
1883
1889
|
return foundryPlatformFetch($ctx, _getLinkedObject, ...args);
|
|
1884
1890
|
}
|
|
1885
1891
|
|
|
1886
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
1892
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.26.0/node_modules/@osdk/foundry.ontologies/build/esm/public/MediaReferenceProperty.js
|
|
1887
1893
|
var MediaReferenceProperty_exports = {};
|
|
1888
1894
|
__export(MediaReferenceProperty_exports, {
|
|
1889
1895
|
getMediaContent: () => getMediaContent,
|
|
@@ -1908,7 +1914,7 @@ function uploadMedia($ctx, ...args) {
|
|
|
1908
1914
|
return foundryPlatformFetch($ctx, _uploadMedia, ...args);
|
|
1909
1915
|
}
|
|
1910
1916
|
|
|
1911
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
1917
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.26.0/node_modules/@osdk/foundry.ontologies/build/esm/public/ObjectTypeV2.js
|
|
1912
1918
|
var ObjectTypeV2_exports = {};
|
|
1913
1919
|
__export(ObjectTypeV2_exports, {
|
|
1914
1920
|
get: () => get3,
|
|
@@ -1938,7 +1944,7 @@ function getOutgoingLinkType($ctx, ...args) {
|
|
|
1938
1944
|
return foundryPlatformFetch($ctx, _getOutgoingLinkType, ...args);
|
|
1939
1945
|
}
|
|
1940
1946
|
|
|
1941
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
1947
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.26.0/node_modules/@osdk/foundry.ontologies/build/esm/public/OntologyInterface.js
|
|
1942
1948
|
var OntologyInterface_exports = {};
|
|
1943
1949
|
__export(OntologyInterface_exports, {
|
|
1944
1950
|
aggregate: () => aggregate,
|
|
@@ -1973,7 +1979,7 @@ function getOutgoingInterfaceLinkType($ctx, ...args) {
|
|
|
1973
1979
|
return foundryPlatformFetch($ctx, _getOutgoingInterfaceLinkType, ...args);
|
|
1974
1980
|
}
|
|
1975
1981
|
|
|
1976
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
1982
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.26.0/node_modules/@osdk/foundry.ontologies/build/esm/public/OntologyObjectSet.js
|
|
1977
1983
|
var OntologyObjectSet_exports = {};
|
|
1978
1984
|
__export(OntologyObjectSet_exports, {
|
|
1979
1985
|
aggregate: () => aggregate2,
|
|
@@ -2008,7 +2014,7 @@ function aggregate2($ctx, ...args) {
|
|
|
2008
2014
|
return foundryPlatformFetch($ctx, _aggregate2, ...args);
|
|
2009
2015
|
}
|
|
2010
2016
|
|
|
2011
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
2017
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.26.0/node_modules/@osdk/foundry.ontologies/build/esm/public/OntologyObjectV2.js
|
|
2012
2018
|
var OntologyObjectV2_exports = {};
|
|
2013
2019
|
__export(OntologyObjectV2_exports, {
|
|
2014
2020
|
aggregate: () => aggregate3,
|
|
@@ -2038,7 +2044,17 @@ function aggregate3($ctx, ...args) {
|
|
|
2038
2044
|
return foundryPlatformFetch($ctx, _aggregate3, ...args);
|
|
2039
2045
|
}
|
|
2040
2046
|
|
|
2041
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
2047
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.26.0/node_modules/@osdk/foundry.ontologies/build/esm/public/OntologyTransaction.js
|
|
2048
|
+
var OntologyTransaction_exports = {};
|
|
2049
|
+
__export(OntologyTransaction_exports, {
|
|
2050
|
+
postEdits: () => postEdits
|
|
2051
|
+
});
|
|
2052
|
+
var _postEdits = [1, "/v2/ontologies/{0}/transactions/{1}/edits", 1];
|
|
2053
|
+
function postEdits($ctx, ...args) {
|
|
2054
|
+
return foundryPlatformFetch($ctx, _postEdits, ...args);
|
|
2055
|
+
}
|
|
2056
|
+
|
|
2057
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.26.0/node_modules/@osdk/foundry.ontologies/build/esm/public/OntologyV2.js
|
|
2042
2058
|
var OntologyV2_exports = {};
|
|
2043
2059
|
__export(OntologyV2_exports, {
|
|
2044
2060
|
get: () => get7,
|
|
@@ -2063,17 +2079,17 @@ function loadMetadata($ctx, ...args) {
|
|
|
2063
2079
|
return foundryPlatformFetch($ctx, _loadMetadata, ...args);
|
|
2064
2080
|
}
|
|
2065
2081
|
|
|
2066
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
2082
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.26.0/node_modules/@osdk/foundry.ontologies/build/esm/public/Query.js
|
|
2067
2083
|
var Query_exports = {};
|
|
2068
2084
|
__export(Query_exports, {
|
|
2069
2085
|
execute: () => execute
|
|
2070
2086
|
});
|
|
2071
|
-
var _execute = [1, "/v2/ontologies/{0}/queries/{1}/execute",
|
|
2087
|
+
var _execute = [1, "/v2/ontologies/{0}/queries/{1}/execute", 7];
|
|
2072
2088
|
function execute($ctx, ...args) {
|
|
2073
2089
|
return foundryPlatformFetch($ctx, _execute, ...args);
|
|
2074
2090
|
}
|
|
2075
2091
|
|
|
2076
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
2092
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.26.0/node_modules/@osdk/foundry.ontologies/build/esm/public/QueryType.js
|
|
2077
2093
|
var QueryType_exports = {};
|
|
2078
2094
|
__export(QueryType_exports, {
|
|
2079
2095
|
get: () => get8,
|
|
@@ -2088,7 +2104,7 @@ function get8($ctx, ...args) {
|
|
|
2088
2104
|
return foundryPlatformFetch($ctx, _get8, ...args);
|
|
2089
2105
|
}
|
|
2090
2106
|
|
|
2091
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
2107
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.26.0/node_modules/@osdk/foundry.ontologies/build/esm/public/TimeSeriesPropertyV2.js
|
|
2092
2108
|
var TimeSeriesPropertyV2_exports = {};
|
|
2093
2109
|
__export(TimeSeriesPropertyV2_exports, {
|
|
2094
2110
|
getFirstPoint: () => getFirstPoint,
|
|
@@ -2108,7 +2124,7 @@ function streamPoints($ctx, ...args) {
|
|
|
2108
2124
|
return foundryPlatformFetch($ctx, _streamPoints, ...args);
|
|
2109
2125
|
}
|
|
2110
2126
|
|
|
2111
|
-
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.
|
|
2127
|
+
// ../../node_modules/.pnpm/@osdk+foundry.ontologies@2.26.0/node_modules/@osdk/foundry.ontologies/build/esm/public/TimeSeriesValueBankProperty.js
|
|
2112
2128
|
var TimeSeriesValueBankProperty_exports = {};
|
|
2113
2129
|
__export(TimeSeriesValueBankProperty_exports, {
|
|
2114
2130
|
getLatestValue: () => getLatestValue,
|
|
@@ -2271,6 +2287,13 @@ __export(TimeSeriesValueBankProperties_exports, {
|
|
|
2271
2287
|
var getLatestValue2 = handleOpenApiCall(TimeSeriesValueBankProperty_exports.getLatestValue, ["ontologyApiName", "objectType", "primaryKey", "propertyName"]);
|
|
2272
2288
|
var streamValues2 = handleOpenApiCall(TimeSeriesValueBankProperty_exports.streamValues, ["ontologyApiName", "objectType", "primaryKey", "propertyName"]);
|
|
2273
2289
|
|
|
2290
|
+
// src/mock/OntologiesV2/Transactions.ts
|
|
2291
|
+
var Transactions_exports = {};
|
|
2292
|
+
__export(Transactions_exports, {
|
|
2293
|
+
postEdits: () => postEdits2
|
|
2294
|
+
});
|
|
2295
|
+
var postEdits2 = handleOpenApiCall(OntologyTransaction_exports.postEdits, ["ontologyApiName", "transactionRid"]);
|
|
2296
|
+
|
|
2274
2297
|
// src/handlers/createActionHandlers.ts
|
|
2275
2298
|
var createActionHandlers = (baseUrl, fauxFoundry) => [
|
|
2276
2299
|
/**
|