@osdk/client 2.0.5 → 2.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.
Files changed (96) hide show
  1. package/CHANGELOG.md +28 -84
  2. package/build/browser/Client.d.ts +1 -1
  3. package/build/browser/Client.js +1 -1
  4. package/build/browser/Client.js.map +1 -1
  5. package/build/browser/createClient.d.ts.map +1 -1
  6. package/build/browser/createClient.js +11 -0
  7. package/build/browser/createClient.js.map +1 -1
  8. package/build/browser/createGeotimeSeriesProperty.d.ts +14 -0
  9. package/build/browser/createGeotimeSeriesProperty.d.ts.map +1 -0
  10. package/build/browser/createGeotimeSeriesProperty.js +47 -0
  11. package/build/browser/createGeotimeSeriesProperty.js.map +1 -0
  12. package/build/browser/createTimeseriesProperty.d.ts.map +1 -1
  13. package/build/browser/createTimeseriesProperty.js +4 -36
  14. package/build/browser/createTimeseriesProperty.js.map +1 -1
  15. package/build/browser/fetchMetadata.test.js +7 -0
  16. package/build/browser/fetchMetadata.test.js.map +1 -1
  17. package/build/browser/object/Cache.test.js +1 -1
  18. package/build/browser/object/Cache.test.js.map +1 -1
  19. package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.d.ts +1 -0
  20. package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.d.ts.map +1 -1
  21. package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.js +1 -0
  22. package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.js.map +1 -1
  23. package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js +15 -1
  24. package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
  25. package/build/browser/object/convertWireToOsdkObjects.test.js +3 -3
  26. package/build/browser/object/convertWireToOsdkObjects.test.js.map +1 -1
  27. package/build/browser/object/geotimeseriesreference.test.d.ts +2 -0
  28. package/build/browser/object/geotimeseriesreference.test.d.ts.map +1 -0
  29. package/build/browser/object/geotimeseriesreference.test.js +257 -0
  30. package/build/browser/object/geotimeseriesreference.test.js.map +1 -0
  31. package/build/browser/objectSet/ObjectSet.test.js +6 -3
  32. package/build/browser/objectSet/ObjectSet.test.js.map +1 -1
  33. package/build/browser/objectSet/ObjectSetListenerWebsocket.d.ts +1 -6
  34. package/build/browser/objectSet/ObjectSetListenerWebsocket.d.ts.map +1 -1
  35. package/build/browser/objectSet/ObjectSetListenerWebsocket.js +37 -156
  36. package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
  37. package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js +17 -16
  38. package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
  39. package/build/browser/objectSet/createObjectSet.js +2 -2
  40. package/build/browser/objectSet/createObjectSet.js.map +1 -1
  41. package/build/browser/objectSet/toConjureObjectSet.js +7 -0
  42. package/build/browser/objectSet/toConjureObjectSet.js.map +1 -1
  43. package/build/browser/util/UserAgent.js +1 -1
  44. package/build/browser/util/UserAgent.js.map +1 -1
  45. package/build/browser/util/timeseriesUtils.d.ts +8 -0
  46. package/build/browser/util/timeseriesUtils.d.ts.map +1 -0
  47. package/build/browser/util/timeseriesUtils.js +51 -0
  48. package/build/browser/util/timeseriesUtils.js.map +1 -0
  49. package/build/esm/Client.d.ts +1 -1
  50. package/build/esm/Client.js +1 -1
  51. package/build/esm/Client.js.map +1 -1
  52. package/build/esm/createClient.d.ts.map +1 -1
  53. package/build/esm/createClient.js +11 -0
  54. package/build/esm/createClient.js.map +1 -1
  55. package/build/esm/createGeotimeSeriesProperty.d.ts +14 -0
  56. package/build/esm/createGeotimeSeriesProperty.d.ts.map +1 -0
  57. package/build/esm/createGeotimeSeriesProperty.js +47 -0
  58. package/build/esm/createGeotimeSeriesProperty.js.map +1 -0
  59. package/build/esm/createTimeseriesProperty.d.ts.map +1 -1
  60. package/build/esm/createTimeseriesProperty.js +4 -36
  61. package/build/esm/createTimeseriesProperty.js.map +1 -1
  62. package/build/esm/fetchMetadata.test.js +7 -0
  63. package/build/esm/fetchMetadata.test.js.map +1 -1
  64. package/build/esm/object/Cache.test.js +1 -1
  65. package/build/esm/object/Cache.test.js.map +1 -1
  66. package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.d.ts +1 -0
  67. package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.d.ts.map +1 -1
  68. package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.js +1 -0
  69. package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.js.map +1 -1
  70. package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js +15 -1
  71. package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
  72. package/build/esm/object/convertWireToOsdkObjects.test.js +3 -3
  73. package/build/esm/object/convertWireToOsdkObjects.test.js.map +1 -1
  74. package/build/esm/object/geotimeseriesreference.test.d.ts +2 -0
  75. package/build/esm/object/geotimeseriesreference.test.d.ts.map +1 -0
  76. package/build/esm/object/geotimeseriesreference.test.js +257 -0
  77. package/build/esm/object/geotimeseriesreference.test.js.map +1 -0
  78. package/build/esm/objectSet/ObjectSet.test.js +6 -3
  79. package/build/esm/objectSet/ObjectSet.test.js.map +1 -1
  80. package/build/esm/objectSet/ObjectSetListenerWebsocket.d.ts +1 -6
  81. package/build/esm/objectSet/ObjectSetListenerWebsocket.d.ts.map +1 -1
  82. package/build/esm/objectSet/ObjectSetListenerWebsocket.js +37 -156
  83. package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
  84. package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js +17 -16
  85. package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
  86. package/build/esm/objectSet/createObjectSet.js +2 -2
  87. package/build/esm/objectSet/createObjectSet.js.map +1 -1
  88. package/build/esm/objectSet/toConjureObjectSet.js +7 -0
  89. package/build/esm/objectSet/toConjureObjectSet.js.map +1 -1
  90. package/build/esm/util/UserAgent.js +1 -1
  91. package/build/esm/util/UserAgent.js.map +1 -1
  92. package/build/esm/util/timeseriesUtils.d.ts +8 -0
  93. package/build/esm/util/timeseriesUtils.d.ts.map +1 -0
  94. package/build/esm/util/timeseriesUtils.js +51 -0
  95. package/build/esm/util/timeseriesUtils.js.map +1 -0
  96. package/package.json +12 -13
package/CHANGELOG.md CHANGED
@@ -1,100 +1,44 @@
1
1
  # @osdk/client
2
2
 
3
- ## 2.0.5
3
+ ## 2.1.0-beta.1
4
4
 
5
- ### Patch Changes
6
-
7
- - Updated dependencies [ca78964]
8
- - @osdk/api@2.0.5
9
- - @osdk/generator-converters@2.0.5
10
- - @osdk/client.unstable@2.0.5
11
-
12
- ## 2.0.4
13
-
14
- ### Patch Changes
15
-
16
- - 7f29753: Avoid type-fest's IsAny as it doesn't always work
17
- - Updated dependencies [7f29753]
18
- - @osdk/api@2.0.4
19
- - @osdk/generator-converters@2.0.4
20
- - @osdk/client.unstable@2.0.4
21
-
22
- ## 2.0.3
23
-
24
- ### Patch Changes
25
-
26
- - @osdk/generator-converters@2.0.3
27
- - @osdk/client.unstable@2.0.3
28
- - @osdk/api@2.0.3
29
-
30
- ## 2.0.2
31
-
32
- ### Patch Changes
33
-
34
- - 1edf95b: Switch to OSDK.Instance
35
- - 135bddc: improves interface api name mapping with api namespaces
36
- - 51354c5: Fixes where clauses when objects have an api namespace
37
- - 4c5e0ae: Fix queries that have response types with nested values, like arrays.
38
- - ba1c42a: Fixing proxy handlers.
39
- - 51354c5: Locks dependency version of 3 internal libraries
40
- - Updated dependencies [1edf95b]
41
- - Updated dependencies [4c5e0ae]
42
- - Updated dependencies [51354c5]
43
- - @osdk/api@2.0.2
44
- - @osdk/generator-converters@2.0.2
45
- - @osdk/client.unstable@2.0.2
46
-
47
- ## 2.0.2-rc.3
48
-
49
- ### Patch Changes
50
-
51
- - 4c5e0ae: Fix queries that have response types with nested values, like arrays.
52
- - ba1c42a: Fixing proxy handlers.
53
- - Updated dependencies [4c5e0ae]
54
- - @osdk/api@2.0.2-rc.3
55
- - @osdk/generator-converters@2.0.2-rc.3
56
- - @osdk/client.unstable@2.0.2-rc.3
57
-
58
- ## 2.0.2-beta.2
59
-
60
- ### Patch Changes
61
-
62
- - 51354c5: Fixes where clauses when objects have an api namespace
63
- - 51354c5: Locks dependency version of 3 internal libraries
64
- - Updated dependencies [51354c5]
65
- - @osdk/generator-converters@2.0.2-beta.2
66
- - @osdk/client.unstable@2.0.2-beta.2
67
- - @osdk/api@2.0.2-beta.2
5
+ ### Minor Changes
68
6
 
69
- ## 2.0.2-beta.1
7
+ - 1812118: Add geotime support for OSDK.
8
+ - 8e6a5f4: Avoid type-fest's IsAny as it doesn't always work
70
9
 
71
10
  ### Patch Changes
72
11
 
73
- - 135bddc: improves interface api name mapping with api namespaces
74
- - @osdk/generator-converters@2.0.2-beta.1
75
- - @osdk/client.unstable@2.0.2-beta.1
76
- - @osdk/api@2.0.2-beta.1
12
+ - Updated dependencies [1812118]
13
+ - Updated dependencies [72c1905]
14
+ - Updated dependencies [6c60414]
15
+ - Updated dependencies [8e6a5f4]
16
+ - @osdk/generator-converters@2.1.0-beta.1
17
+ - @osdk/api@2.1.0-beta.1
18
+ - @osdk/client.unstable@2.1.0-beta.1
77
19
 
78
- ## 2.0.2-rc.0
20
+ ## 2.1.0-beta.0
79
21
 
80
- ### Patch Changes
81
-
82
- - @osdk/generator-converters@2.0.2-rc.0
83
- - @osdk/client.unstable@2.0.2-rc.0
84
- - @osdk/api@2.0.2-rc.0
22
+ ### Minor Changes
85
23
 
86
- ## 2.0.1
24
+ - 0dc40b0: Switch to OSDK.Instance
25
+ - d927a1d: Throws error in createClient when passed an invalid ontology RID
26
+ - d464009: improves interface api name mapping with api namespaces
27
+ - 8eb2378: Fixes where clauses when objects have an api namespace
28
+ - e548b9b: Updates subscribe to return object updates
29
+ - 5e78575: Fix queries that have response types with nested values, like arrays.
30
+ - 9af346e: Fixing proxy handlers.
31
+ - c682504: Locks dependency version of 3 internal libraries
87
32
 
88
33
  ### Patch Changes
89
34
 
90
- - Updated dependencies [a4343af]
91
- - @osdk/shared.client@1.0.1
92
- - @osdk/internal.foundry.core@0.2.1
93
- - @osdk/internal.foundry.ontologiesv2@0.2.1
94
- - @osdk/shared.client.impl@1.0.1
95
- - @osdk/generator-converters@2.0.1
96
- - @osdk/api@2.0.1
97
- - @osdk/client.unstable@2.0.1
35
+ - Updated dependencies [0dc40b0]
36
+ - Updated dependencies [03e1941]
37
+ - Updated dependencies [e548b9b]
38
+ - Updated dependencies [c682504]
39
+ - @osdk/api@2.1.0-beta.0
40
+ - @osdk/generator-converters@2.1.0-beta.0
41
+ - @osdk/client.unstable@2.1.0-beta.0
98
42
 
99
43
  ## 2.0.0
100
44
 
@@ -32,7 +32,7 @@ export interface Client extends SharedClient<MinimalClient> {
32
32
  */
33
33
  readonly [__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks]: <T extends ObjectOrInterfaceDefinition>(objs: Osdk<T>[], links: string[]) => AsyncGenerator<BulkLinkResult, void, undefined>;
34
34
  }
35
- declare const MaxOsdkVersion = "2.0.5";
35
+ declare const MaxOsdkVersion = "2.1.0";
36
36
  export type MaxOsdkVersion = typeof MaxOsdkVersion;
37
37
  declare const ErrorMessage: unique symbol;
38
38
  export {};
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  // BEGIN: THIS IS GENERATED CODE. DO NOT EDIT.
17
- const MaxOsdkVersion = "2.0.5";
17
+ const MaxOsdkVersion = "2.1.0";
18
18
  const ErrorMessage = Symbol("ErrorMessage");
19
19
  export {};
20
20
  //# sourceMappingURL=Client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Client.js","names":["MaxOsdkVersion","ErrorMessage","Symbol"],"sources":["Client.js"],"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// BEGIN: THIS IS GENERATED CODE. DO NOT EDIT.\nconst MaxOsdkVersion = \"2.0.5\";\nconst ErrorMessage = Symbol(\"ErrorMessage\");\nexport {};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,cAAc,GAAG,OAAO;AAC9B,MAAMC,YAAY,GAAGC,MAAM,CAAC,cAAc,CAAC;AAC3C","ignoreList":[]}
1
+ {"version":3,"file":"Client.js","names":["MaxOsdkVersion","ErrorMessage","Symbol"],"sources":["Client.js"],"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// BEGIN: THIS IS GENERATED CODE. DO NOT EDIT.\nconst MaxOsdkVersion = \"2.1.0\";\nconst ErrorMessage = Symbol(\"ErrorMessage\");\nexport {};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,cAAc,GAAG,OAAO;AAC9B,MAAMC,YAAY,GAAGC,MAAM,CAAC,cAAc,CAAC;AAC3C","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"createClient.d.ts","sourceRoot":"","sources":["../../src/createClient.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAyI1C,eAAO,MAAM,YAAY,gFA7FF,OAAO,CAAC,MAAM,CAAC;aAChB,MAAM;4DA+F3B,CAAC"}
1
+ {"version":3,"file":"createClient.d.ts","sourceRoot":"","sources":["../../src/createClient.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAqJ1C,eAAO,MAAM,YAAY,gFAzGF,OAAO,CAAC,MAAM,CAAC;aAChB,MAAM;4DA2G3B,CAAC"}
@@ -43,6 +43,17 @@ class QueryInvoker {
43
43
  export function createClientInternal(objectSetFactory,
44
44
  // first so i can bind
45
45
  baseUrl, ontologyRid, tokenProvider, options = undefined, fetchFn = fetch) {
46
+ if (typeof ontologyRid === "string") {
47
+ if (!ontologyRid.startsWith("ri.")) {
48
+ throw new Error("Invalid ontology RID");
49
+ }
50
+ } else {
51
+ ontologyRid.then(ontologyRid => {
52
+ if (!ontologyRid.startsWith("ri.")) {
53
+ throw new Error("Invalid ontology RID");
54
+ }
55
+ });
56
+ }
46
57
  const clientCtx = createMinimalClient({
47
58
  ontologyRid
48
59
  }, baseUrl, tokenProvider, options, fetchFn, objectSetFactory);
@@ -1 +1 @@
1
- {"version":3,"file":"createClient.js","names":["__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks","__EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet","symbolClientContext","createBulkLinksAsyncIterFactory","applyAction","createMinimalClient","fetchMetadataInternal","createObjectSet","applyQuery","ActionInvoker","constructor","clientCtx","actionDef","bind","undefined","batchApplyAction","QueryInvoker","queryDef","executeFunction","createClientInternal","objectSetFactory","baseUrl","ontologyRid","tokenProvider","options","fetchFn","fetch","fetchMetadata","client","Object","defineProperties","o","type","Error","value","get","definition","rid","objectSets","objectType","apiName","reference","createClient"],"sources":["createClient.js"],"sourcesContent":["/*\n * Copyright 2024 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 */\nimport { __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks, __EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet, } from \"@osdk/api/unstable\";\nimport { symbolClientContext } from \"@osdk/shared.client\";\nimport { createBulkLinksAsyncIterFactory } from \"./__unstable/createBulkLinksAsyncIterFactory.js\";\nimport { applyAction } from \"./actions/applyAction.js\";\nimport { createMinimalClient } from \"./createMinimalClient.js\";\nimport { fetchMetadataInternal } from \"./fetchMetadata.js\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport { applyQuery } from \"./queries/applyQuery.js\";\nclass ActionInvoker {\n constructor(clientCtx, actionDef) {\n // We type the property as a generic function as binding `applyAction`\n // doesn't return a type thats all that useful anyway\n // The implements covers us for the most part here as this exact type doesn't\n // escape this file\n this.applyAction = applyAction.bind(undefined, clientCtx, actionDef);\n this.batchApplyAction = applyAction.bind(undefined, clientCtx, actionDef);\n }\n applyAction;\n batchApplyAction;\n}\nclass QueryInvoker {\n constructor(clientCtx, queryDef) {\n this.executeFunction = applyQuery.bind(undefined, clientCtx, queryDef);\n }\n executeFunction;\n}\n/** @internal */\nexport function createClientInternal(objectSetFactory, // first so i can bind\nbaseUrl, ontologyRid, tokenProvider, options = undefined, fetchFn = fetch) {\n const clientCtx = createMinimalClient({ ontologyRid }, baseUrl, tokenProvider, options, fetchFn, objectSetFactory);\n function clientFn(o) {\n if (o.type === \"object\" || o.type === \"interface\") {\n return objectSetFactory(o, clientCtx);\n }\n else if (o.type === \"action\") {\n return new ActionInvoker(clientCtx, o); // then as any for dealing with the conditional return value\n }\n else if (o.type === \"query\") {\n return new QueryInvoker(clientCtx, o);\n }\n else {\n throw new Error(\"not implemented\");\n }\n }\n const fetchMetadata = fetchMetadataInternal.bind(undefined, clientCtx);\n const client = Object.defineProperties(clientFn, {\n [symbolClientContext]: {\n value: clientCtx,\n },\n [__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks]: {\n get: () => createBulkLinksAsyncIterFactory(clientCtx),\n },\n [__EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet]: {\n get: () => (definition, rid) => {\n return createObjectSet(definition, client[symbolClientContext], {\n type: \"intersect\",\n objectSets: [\n {\n type: \"base\",\n objectType: definition.apiName,\n },\n {\n type: \"reference\",\n reference: rid,\n },\n ],\n });\n },\n },\n fetchMetadata: {\n value: fetchMetadata,\n },\n });\n return client;\n}\nexport const createClient = createClientInternal.bind(undefined, createObjectSet);\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,+CAA+C,EAAEC,uDAAuD,QAAS,oBAAoB;AAC9I,SAASC,mBAAmB,QAAQ,qBAAqB;AACzD,SAASC,+BAA+B,QAAQ,iDAAiD;AACjG,SAASC,WAAW,QAAQ,0BAA0B;AACtD,SAASC,mBAAmB,QAAQ,0BAA0B;AAC9D,SAASC,qBAAqB,QAAQ,oBAAoB;AAC1D,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SAASC,UAAU,QAAQ,yBAAyB;AACpD,MAAMC,aAAa,CAAC;EAChBC,WAAWA,CAACC,SAAS,EAAEC,SAAS,EAAE;IAC9B;IACA;IACA;IACA;IACA,IAAI,CAACR,WAAW,GAAGA,WAAW,CAACS,IAAI,CAACC,SAAS,EAAEH,SAAS,EAAEC,SAAS,CAAC;IACpE,IAAI,CAACG,gBAAgB,GAAGX,WAAW,CAACS,IAAI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ACnBgC,KAAK,EAAEvB;IACX,CAAC;IACD,CAACX,+CAA+C,GAAG;MAC/CmC,GAAG,EAAEA,CAAA,KAAMhC,+BAA+B,CAACQ,SAAS;IACxD,CAAC;IACD,CAACV,uDAAuD,GAAG;MACvDkC,GAAG,EAAEA,CAAA,KAAM,CAACC,UAAU,EAAEC,GAAG,KAAK;QAC5B,OAAO9B,eAAe,CAAC6B,UAAU,EAAER,MAAM,CAAC1B,mBAAmB,CAAC,EAAE;UAC5D8B,IAAI,EAAE,WAAW;UACjBM,UAAU,EAAE,CACR;YACIN,IAAI,EAAE,MAAM;YACZO,UAAU,EAAEH,UAAU,CAACI;UAC3B,CAAC,EACD;YACIR,IAAI,EAAE,WAAW;YACjBS,SAAS,EAAEJ;UACf,CAAC;QAET,CAAC,CAAC;MACN;IACJ,CAAC;IACDV,aAAa,EAAE;MACXO,KAAK,EAAEP;IACX;EACJ,CAAC,CAAC;EACF,OAAOC,MAAM;AACjB;AACA,OAAO,MAAMc,YAAY,GAAGvB,oBAAoB,CAACN,IAAI,CAACC,SAAS,EAAEP,eAAe,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"createClient.js","names":["__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks","__EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet","symbolClientContext","createBulkLinksAsyncIterFactory","applyAction","createMinimalClient","fetchMetadataInternal","createObjectSet","applyQuery","ActionInvoker","constructor","clientCtx","actionDef","bind","undefined","batchApplyAction","QueryInvoker","queryDef","executeFunction","createClientInternal","objectSetFactory","baseUrl","ontologyRid","tokenProvider","options","fetchFn","fetch","startsWith","Error","then","fetchMetadata","client","Object","defineProperties","o","type","value","get","definition","rid","objectSets","objectType","apiName","reference","createClient"],"sources":["createClient.js"],"sourcesContent":["/*\n * Copyright 2024 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 */\nimport { __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks, __EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet, } from \"@osdk/api/unstable\";\nimport { symbolClientContext } from \"@osdk/shared.client\";\nimport { createBulkLinksAsyncIterFactory } from \"./__unstable/createBulkLinksAsyncIterFactory.js\";\nimport { applyAction } from \"./actions/applyAction.js\";\nimport { createMinimalClient } from \"./createMinimalClient.js\";\nimport { fetchMetadataInternal } from \"./fetchMetadata.js\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport { applyQuery } from \"./queries/applyQuery.js\";\nclass ActionInvoker {\n constructor(clientCtx, actionDef) {\n // We type the property as a generic function as binding `applyAction`\n // doesn't return a type thats all that useful anyway\n // The implements covers us for the most part here as this exact type doesn't\n // escape this file\n this.applyAction = applyAction.bind(undefined, clientCtx, actionDef);\n this.batchApplyAction = applyAction.bind(undefined, clientCtx, actionDef);\n }\n applyAction;\n batchApplyAction;\n}\nclass QueryInvoker {\n constructor(clientCtx, queryDef) {\n this.executeFunction = applyQuery.bind(undefined, clientCtx, queryDef);\n }\n executeFunction;\n}\n/** @internal */\nexport function createClientInternal(objectSetFactory, // first so i can bind\nbaseUrl, ontologyRid, tokenProvider, options = undefined, fetchFn = fetch) {\n if (typeof ontologyRid === \"string\") {\n if (!ontologyRid.startsWith(\"ri.\")) {\n throw new Error(\"Invalid ontology RID\");\n }\n }\n else {\n ontologyRid.then((ontologyRid) => {\n if (!ontologyRid.startsWith(\"ri.\")) {\n throw new Error(\"Invalid ontology RID\");\n }\n });\n }\n const clientCtx = createMinimalClient({ ontologyRid }, baseUrl, tokenProvider, options, fetchFn, objectSetFactory);\n function clientFn(o) {\n if (o.type === \"object\" || o.type === \"interface\") {\n return objectSetFactory(o, clientCtx);\n }\n else if (o.type === \"action\") {\n return new ActionInvoker(clientCtx, o); // then as any for dealing with the conditional return value\n }\n else if (o.type === \"query\") {\n return new QueryInvoker(clientCtx, o);\n }\n else {\n throw new Error(\"not implemented\");\n }\n }\n const fetchMetadata = fetchMetadataInternal.bind(undefined, clientCtx);\n const client = Object.defineProperties(clientFn, {\n [symbolClientContext]: {\n value: clientCtx,\n },\n [__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks]: {\n get: () => createBulkLinksAsyncIterFactory(clientCtx),\n },\n [__EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet]: {\n get: () => (definition, rid) => {\n return createObjectSet(definition, client[symbolClientContext], {\n type: \"intersect\",\n objectSets: [\n {\n type: \"base\",\n objectType: definition.apiName,\n },\n {\n type: \"reference\",\n reference: rid,\n },\n ],\n });\n },\n },\n fetchMetadata: {\n value: fetchMetadata,\n },\n });\n return client;\n}\nexport const createClient = createClientInternal.bind(undefined, createObjectSet);\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,+CAA+C,EAAEC,uDAAuD,QAAS,oBAAoB;AAC9I,SAASC,mBAAmB,QAAQ,qBAAqB;AACzD,SAASC,+BAA+B,QAAQ,iDAAiD;AACjG,SAASC,WAAW,QAAQ,0BAA0B;AACtD,SAASC,mBAAmB,QAAQ,0BAA0B;AAC9D,SAASC,qBAAqB,QAAQ,oBAAoB;AAC1D,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SAASC,UAAU,QAAQ,yBAAyB;AACpD,MAAMC,aAAa,CAAC;EAChBC,WAAWA,CAACC,SAAS,EAAEC,SAAS,EAAE;IAC9B;IACA;IACA;IACA;IACA,IAAI,CAACR,WAAW,GAAGA,WAAW,CAACS,IAAI,CAACC,SAAS,EAAEH,SAAS,EAAEC,SAAS,CAAC;IACpE,I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AAC,EAAEvB,SAAS,CAAC;IACzC,CAAC,MACI,IAAIuB,CAAC,CAACC,IAAI,KAAK,QAAQ,EAAE;MAC1B,OAAO,IAAI1B,aAAa,CAACE,SAAS,EAAEuB,CAAC,CAAC,CAAC,CAAC;IAC5C,CAAC,MACI,IAAIA,CAAC,CAACC,IAAI,KAAK,OAAO,EAAE;MACzB,OAAO,IAAInB,YAAY,CAACL,SAAS,EAAEuB,CAAC,CAAC;IACzC,CAAC,MACI;MACD,MAAM,IAAIN,KAAK,CAAC,iBAAiB,CAAC;IACtC;EACJ,CAAC,EAEgD;IAC7C,CAAC1B,mBAAmB,GAAG;MACnBkC,KAAK,EAAEzB;IACX,CAAC;IACD,CAACX,+CAA+C,GAAG;MAC/CqC,GAAG,EAAEA,CAAA,KAAMlC,+BAA+B,CAACQ,SAAS;IACxD,CAAC;IACD,CAACV,uDAAuD,GAAG;MACvDoC,GAAG,EAAEA,CAAA,KAAM,CAACC,UAAU,EAAEC,GAAG,KAAK;QAC5B,OAAOhC,eAAe,CAAC+B,UAAU,EAAEP,MAAM,CAAC7B,mBAAmB,CAAC,EAAE;UAC5DiC,IAAI,EAAE,WAAW;UACjBK,UAAU,EAAE,CACR;YACIL,IAAI,EAAE,MAAM;YACZM,UAAU,EAAEH,UAAU,CAACI;UAC3B,CAAC,EACD;YACIP,IAAI,EAAE,WAAW;YACjBQ,SAAS,EAAEJ;UACf,CAAC;QAET,CAAC,CAAC;MACN;IACJ,CAAC;IACDT,aAAa,EAAE;MACXM,KAAK,EAAEN;IACX;EACJ,CAAC,CAAC;EACF,OAAOC,MAAM;AACjB;AACA,OAAO,MAAMa,YAAY,GAAGzB,oBAAoB,CAACN,IAAI,CAACC,SAAS,EAAEP,eAAe,CAAC","ignoreList":[]}
@@ -0,0 +1,14 @@
1
+ import type { GeotimeSeriesProperty, TimeSeriesPoint, TimeSeriesQuery } from "@osdk/api";
2
+ import type { MinimalClient } from "./MinimalClientContext.js";
3
+ export declare class GeotimeSeriesPropertyImpl<T extends GeoJSON.Point> implements GeotimeSeriesProperty<T> {
4
+ #private;
5
+ lastFetchedValue: TimeSeriesPoint<T> | undefined;
6
+ constructor(client: MinimalClient, objectApiName: string, primaryKey: any, propertyName: string);
7
+ getLatestValue(): Promise<TimeSeriesPoint<T> | undefined>;
8
+ getAllValues(query?: TimeSeriesQuery): Promise<TimeSeriesPoint<T>[]>;
9
+ asyncIterValues(query?: TimeSeriesQuery): AsyncGenerator<{
10
+ time: any;
11
+ value: T;
12
+ }, void, unknown>;
13
+ }
14
+ //# sourceMappingURL=createGeotimeSeriesProperty.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createGeotimeSeriesProperty.d.ts","sourceRoot":"","sources":["../../src/createGeotimeSeriesProperty.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,qBAAqB,EACrB,eAAe,EAEf,eAAe,EAChB,MAAM,WAAW,CAAC;AAInB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAO/D,qBAAa,yBAAyB,CAAC,CAAC,SAAS,OAAO,CAAC,KAAK,CAC5D,YAAW,qBAAqB,CAAC,CAAC,CAAC;;IAInC,gBAAgB,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;gBAG/C,MAAM,EAAE,aAAa,EACrB,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,GAAG,EACf,YAAY,EAAE,MAAM;IAMT,cAAc,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAWzD,YAAY,CAAC,KAAK,CAAC,EAAE,eAAe;IASnC,eAAe,CAC3B,KAAK,CAAC,EAAE,eAAe;;;;CAgB1B"}
@@ -0,0 +1,47 @@
1
+ /*
2
+ * Copyright 2024 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
+ import * as OntologiesV2 from "@osdk/internal.foundry.ontologiesv2";
17
+ import { asyncIterPointsHelper, getTimeRange } from "./util/timeseriesUtils.js";
18
+ export class GeotimeSeriesPropertyImpl {
19
+ #triplet;
20
+ #client;
21
+ lastFetchedValue;
22
+ constructor(client, objectApiName, primaryKey, propertyName) {
23
+ this.#client = client;
24
+ this.#triplet = [objectApiName, primaryKey, propertyName];
25
+ }
26
+ async getLatestValue() {
27
+ const latestPointPromise = OntologiesV2.TimeSeriesValueBankProperties.getLatestValue(this.#client, await this.#client.ontologyRid, ...this.#triplet);
28
+ latestPointPromise.then(latestPoint => this.lastFetchedValue = latestPoint);
29
+ return latestPointPromise;
30
+ }
31
+ async getAllValues(query) {
32
+ const allPoints = [];
33
+ for await (const point of this.asyncIterValues(query)) {
34
+ allPoints.push(point);
35
+ }
36
+ return allPoints;
37
+ }
38
+ async *asyncIterValues(query) {
39
+ const streamPointsIterator = await OntologiesV2.TimeSeriesValueBankProperties.streamValues(this.#client, await this.#client.ontologyRid, ...this.#triplet, query ? {
40
+ range: getTimeRange(query)
41
+ } : {});
42
+ for await (const timeseriesPoint of asyncIterPointsHelper(streamPointsIterator)) {
43
+ yield timeseriesPoint;
44
+ }
45
+ }
46
+ }
47
+ //# sourceMappingURL=createGeotimeSeriesProperty.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createGeotimeSeriesProperty.js","names":["OntologiesV2","asyncIterPointsHelper","getTimeRange","GeotimeSeriesPropertyImpl","triplet","client","lastFetchedValue","constructor","objectApiName","primaryKey","propertyName","getLatestValue","latestPointPromise","TimeSeriesValueBankProperties","ontologyRid","then","latestPoint","getAllValues","query","allPoints","point","asyncIterValues","push","streamPointsIterator","streamValues","range","timeseriesPoint"],"sources":["createGeotimeSeriesProperty.js"],"sourcesContent":["/*\n * Copyright 2024 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 */\nimport * as OntologiesV2 from \"@osdk/internal.foundry.ontologiesv2\";\nimport { asyncIterPointsHelper, getTimeRange } from \"./util/timeseriesUtils.js\";\nexport class GeotimeSeriesPropertyImpl {\n #triplet;\n #client;\n lastFetchedValue;\n constructor(client, objectApiName, primaryKey, propertyName) {\n this.#client = client;\n this.#triplet = [objectApiName, primaryKey, propertyName];\n }\n async getLatestValue() {\n const latestPointPromise = OntologiesV2.TimeSeriesValueBankProperties\n .getLatestValue(this.#client, await this.#client.ontologyRid, ...this.#triplet);\n latestPointPromise.then(latestPoint => this.lastFetchedValue = latestPoint);\n return latestPointPromise;\n }\n async getAllValues(query) {\n const allPoints = [];\n for await (const point of this.asyncIterValues(query)) {\n allPoints.push(point);\n }\n return allPoints;\n }\n async *asyncIterValues(query) {\n const streamPointsIterator = await OntologiesV2\n .TimeSeriesValueBankProperties.streamValues(this.#client, await this.#client.ontologyRid, ...this.#triplet, query ? { range: getTimeRange(query) } : {});\n for await (const timeseriesPoint of asyncIterPointsHelper(streamPointsIterator)) {\n yield timeseriesPoint;\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,YAAY,MAAM,qCAAqC;AACnE,SAASC,qBAAqB,EAAEC,YAAY,QAAQ,2BAA2B;AAC/E,OAAO,MAAMC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IACzB;EACJ;AACJ","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"createTimeseriesProperty.d.ts","sourceRoot":"","sources":["../../src/createTimeseriesProperty.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,eAAe,EAChB,MAAM,WAAW,CAAC;AAInB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAM/D,qBAAa,sBAAsB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAC3D,YAAW,kBAAkB,CAAC,CAAC,CAAC;;gBAM9B,MAAM,EAAE,aAAa,EACrB,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,GAAG,EACf,YAAY,EAAE,MAAM;IAMT,aAAa;IAQb,YAAY;IAQZ,YAAY,CAAC,KAAK,CAAC,EAAE,eAAe;IAYnC,eAAe,CAC3B,KAAK,CAAC,EAAE,eAAe;;eAgBG,CAAC;;CAI9B"}
1
+ {"version":3,"file":"createTimeseriesProperty.d.ts","sourceRoot":"","sources":["../../src/createTimeseriesProperty.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,eAAe,EAChB,MAAM,WAAW,CAAC;AAInB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAO/D,qBAAa,sBAAsB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAC3D,YAAW,kBAAkB,CAAC,CAAC,CAAC;;gBAM9B,MAAM,EAAE,aAAa,EACrB,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,GAAG,EACf,YAAY,EAAE,MAAM;IAMT,aAAa;IAQb,YAAY;IAQZ,YAAY,CAAC,KAAK,CAAC,EAAE,eAAe;IASnC,eAAe,CAC3B,KAAK,CAAC,EAAE,eAAe;;;;CAgB1B"}
@@ -13,9 +13,8 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { TimeseriesDurationMapping } from "@osdk/api";
17
16
  import * as OntologiesV2 from "@osdk/internal.foundry.ontologiesv2";
18
- import { iterateReadableStream, parseStreamedResponse } from "./util/streamutils.js";
17
+ import { asyncIterPointsHelper, getTimeRange } from "./util/timeseriesUtils.js";
19
18
  export class TimeSeriesPropertyImpl {
20
19
  #triplet;
21
20
  #client;
@@ -32,10 +31,7 @@ export class TimeSeriesPropertyImpl {
32
31
  async getAllPoints(query) {
33
32
  const allPoints = [];
34
33
  for await (const point of this.asyncIterPoints(query)) {
35
- allPoints.push({
36
- time: point.time,
37
- value: point.value
38
- });
34
+ allPoints.push(point);
39
35
  }
40
36
  return allPoints;
41
37
  }
@@ -43,37 +39,9 @@ export class TimeSeriesPropertyImpl {
43
39
  const streamPointsIterator = await OntologiesV2.TimeSeriesPropertiesV2.streamPoints(this.#client, await this.#client.ontologyRid, ...this.#triplet, query ? {
44
40
  range: getTimeRange(query)
45
41
  } : {});
46
- const reader = streamPointsIterator.stream().getReader();
47
- for await (const point of parseStreamedResponse(iterateReadableStream(reader))) {
48
- yield {
49
- time: point.time,
50
- value: point.value
51
- };
42
+ for await (const timeseriesPoint of asyncIterPointsHelper(streamPointsIterator)) {
43
+ yield timeseriesPoint;
52
44
  }
53
45
  }
54
46
  }
55
- function getTimeRange(body) {
56
- if ("$startTime" in body || "$endTime" in body) {
57
- return {
58
- type: "absolute",
59
- startTime: body.$startTime,
60
- endTime: body.$endTime
61
- };
62
- }
63
- return body.$before ? {
64
- type: "relative",
65
- startTime: {
66
- when: "BEFORE",
67
- value: body.$before,
68
- unit: TimeseriesDurationMapping[body.$unit]
69
- }
70
- } : {
71
- type: "relative",
72
- endTime: {
73
- when: "AFTER",
74
- value: body.$after,
75
- unit: TimeseriesDurationMapping[body.$unit]
76
- }
77
- };
78
- }
79
47
  //# sourceMappingURL=createTimeseriesProperty.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createTimeseriesProperty.js","names":["TimeseriesDurationMapping","OntologiesV2","iterateReadableStream","parseStreamedResponse","TimeSeriesPropertyImpl","triplet","client","constructor","objectApiName","primaryKey","propertyName","getFirstPoint","TimeSeriesPropertiesV2","ontologyRid","getLastPoint","getAllPoints","query","allPoints","point","asyncIterPoints","push","time","value","streamPointsIterator","streamPoints","range","getTimeRange","reader","stream","getReader","body","type","startTime","$startTime","endTime","$endTime","$before","when","unit","$unit","$after"],"sources":["createTimeseriesProperty.js"],"sourcesContent":["/*\n * Copyright 2024 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 */\nimport { TimeseriesDurationMapping } from \"@osdk/api\";\nimport * as OntologiesV2 from \"@osdk/internal.foundry.ontologiesv2\";\nimport { iterateReadableStream, parseStreamedResponse, } from \"./util/streamutils.js\";\nexport class TimeSeriesPropertyImpl {\n #triplet;\n #client;\n constructor(client, objectApiName, primaryKey, propertyName) {\n this.#client = client;\n this.#triplet = [objectApiName, primaryKey, propertyName];\n }\n async getFirstPoint() {\n return OntologiesV2.TimeSeriesPropertiesV2.getFirstPoint(this.#client, await this.#client.ontologyRid, ...this.#triplet);\n }\n async getLastPoint() {\n return OntologiesV2.TimeSeriesPropertiesV2.getLastPoint(this.#client, await this.#client.ontologyRid, ...this.#triplet);\n }\n async getAllPoints(query) {\n const allPoints = [];\n for await (const point of this.asyncIterPoints(query)) {\n allPoints.push({\n time: point.time,\n value: point.value,\n });\n }\n return allPoints;\n }\n async *asyncIterPoints(query) {\n const streamPointsIterator = await OntologiesV2.TimeSeriesPropertiesV2\n .streamPoints(this.#client, await this.#client.ontologyRid, ...this.#triplet, query ? { range: getTimeRange(query) } : {});\n const reader = streamPointsIterator.stream().getReader();\n for await (const point of parseStreamedResponse(iterateReadableStream(reader))) {\n yield {\n time: point.time,\n value: point.value,\n };\n }\n }\n}\nfunction getTimeRange(body) {\n if (\"$startTime\" in body || \"$endTime\" in body) {\n return {\n type: \"absolute\",\n startTime: body.$startTime,\n endTime: body.$endTime,\n };\n }\n return body.$before\n ? {\n type: \"relative\",\n startTime: {\n when: \"BEFORE\",\n value: body.$before,\n unit: TimeseriesDurationMapping[body.$unit],\n },\n }\n : {\n type: \"relative\",\n endTime: {\n when: \"AFTER\",\n value: body.$after,\n unit: TimeseriesDurationMapping[body.$unit],\n },\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,yBAAyB,QAAQ,WAAW;AACrD,OAAO,KAAKC,YAAY,MAAM,qCAAqC;AACnE,SAASC,qBAAqB,EAAEC,qBAAqB,QAAS,uBAAuB;AACrF,OAAO,MAAMC,sBAAsB,CAAC;EAChC,CAACC,OAAO;EACR,CAACC,MAAM;EACPC,WAAWA,CAACD,MAAM,EAAEE,aAAa,EAAEC,UAAU,EAAEC,YAAY,EAAE;IACzD,IAAI,CAAC,CAACJ,MAAM,GAAGA,MAAM;IACrB,IAAI,CAAC,CAACD,OAAO,GAAG,CAACG,aAAa,EAAEC,UAAU,EAAEC,YAAY,CAAC;EAC7D;EACA,MAAMC,aAAaA,CAAA,EAAG;IAClB,OAAOV,YAAY,CAACW,sBAAsB,CAACD,aAAa,CAAC,IAAI,CAAC,CAACL,MAAM,EAAE,MAAM,IAAI,CAAC,CAACA,MAAM,CAACO,WAAW,EAAE,GAAG,IAAI,CAAC,CAACR,OAAO,CAAC;EAC5H;EACA,MAAMS,YAAYA,CAAA,EAAG;IACjB,OAAOb,YAAY,CAACW,sBAAsB,CAACE,YAAY,CAAC,IAAI,CAAC,CAACR,MAAM,EAAE,MAAM,IAAI,CAAC,CAACA,MAAM,CAACO,WAAW,EAAE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AS,EAAE;MACPK,IAAI,EAAE,QAAQ;MACdf,KAAK,EAAEQ,IAAI,CAACM,OAAO;MACnBE,IAAI,EAAEtC,yBAAyB,CAAC8B,IAAI,CAACS,KAAK;IAC9C;EACJ,CAAC,GACC;IACER,IAAI,EAAE,UAAU;IAChBG,OAAO,EAAE;MACLG,IAAI,EAAE,OAAO;MACbf,KAAK,EAAEQ,IAAI,CAACU,MAAM;MAClBF,IAAI,EAAEtC,yBAAyB,CAAC8B,IAAI,CAACS,KAAK;IAC9C;EACJ,CAAC;AACT","ignoreList":[]}
1
+ {"version":3,"file":"createTimeseriesProperty.js","names":["OntologiesV2","asyncIterPointsHelper","getTimeRange","TimeSeriesPropertyImpl","triplet","client","constructor","objectApiName","primaryKey","propertyName","getFirstPoint","TimeSeriesPropertiesV2","ontologyRid","getLastPoint","getAllPoints","query","allPoints","point","asyncIterPoints","push","streamPointsIterator","streamPoints","range","timeseriesPoint"],"sources":["createTimeseriesProperty.js"],"sourcesContent":["/*\n * Copyright 2024 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 */\nimport * as OntologiesV2 from \"@osdk/internal.foundry.ontologiesv2\";\nimport { asyncIterPointsHelper, getTimeRange } from \"./util/timeseriesUtils.js\";\nexport class TimeSeriesPropertyImpl {\n #triplet;\n #client;\n constructor(client, objectApiName, primaryKey, propertyName) {\n this.#client = client;\n this.#triplet = [objectApiName, primaryKey, propertyName];\n }\n async getFirstPoint() {\n return OntologiesV2.TimeSeriesPropertiesV2.getFirstPoint(this.#client, await this.#client.ontologyRid, ...this.#triplet);\n }\n async getLastPoint() {\n return OntologiesV2.TimeSeriesPropertiesV2.getLastPoint(this.#client, await this.#client.ontologyRid, ...this.#triplet);\n }\n async getAllPoints(query) {\n const allPoints = [];\n for await (const point of this.asyncIterPoints(query)) {\n allPoints.push(point);\n }\n return allPoints;\n }\n async *asyncIterPoints(query) {\n const streamPointsIterator = await OntologiesV2.TimeSeriesPropertiesV2\n .streamPoints(this.#client, await this.#client.ontologyRid, ...this.#triplet, query ? { range: getTimeRange(query) } : {});\n for await (const timeseriesPoint of asyncIterPointsHelper(streamPointsIterator)) {\n yield timeseriesPoint;\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,YAAY,MAAM,qCAAqC;AACnE,SAASC,qBAAqB,EAAEC,YAAY,QAAQ,2BAA2B;AAC/E,OAAO,MAAMC,sBAAsB,CAAC;EAChC,CAACC,OAAO;EACR,CAACC,MAAM;EACPC,WAAWA,CAACD,MAAM,EAAEE,aAAa,EAAEC,UAAU,EAAEC,YAAY,EAAE;IACzD,IAAI,CAAC,CAACJ,MAAM,GAAGA,MAAM;IACrB,IAAI,CAAC,CAACD,OAAO,GAAG,CAACG,aAAa,EAAEC,UAAU,EAAEC,YAAY,CAAC;EAC7D;EACA,MAAMC,aAAaA,CAAA,EAAG;IAClB,OAAOV,YAAY,CAACW,sBAAsB,CAACD,aAAa,CAAC,IAAI,CAAC,CAACL,MAAM,EAAE,MAAM,IAAI,CAAC,CAACA,MAAM,CAACO,WAAW,EAAE,GAAG,IAAI,CAAC,CAACR,OAAO,CAAC;EAC5H;EACA,MAAMS,YAAYA,CAAA,EAAG;IACjB,OAAOb,YAAY,CAACW,sBAAsB,CAACE,YAAY,CAAC,IAAI,CAAC,CAACR,MAAM,EAAE,MAAM,IAAI,CAAC,CAACA,MAAM,CAACO,WAAW,EAAE,GAAG,IAAI,CAAC,CAACR,OAAO,CAAC;EAC3H;EACA,MAAMU,YAAYA,CAACC,KAAK,EAAE;IACtB,MAAMC,SAAS,GAAG,EAAE;IACpB,WAAW,MAAMC,KAAK,IAAI,IAAI,CAACC,eAAe,CAACH,KAAK,CAAC,EAAE;MACnDC,SAAS,CAACG,IAAI,CAACF,KAAK,CAAC;IACzB;IACA,OAAOD,SAAS;EACpB;EACA,OAAOE,eAAeA,CAACH,KAAK,EAAE;IAC1B,MAAMK,oBAAoB,GAAG,MAAMpB,YAAY,CAACW,sBAAsB,CACjEU,YAAY,CAAC,IAAI,CAAC,CAAChB,MAAM,EAAE,MAAM,IAAI,CAAC,CAACA,MAAM,CAACO,WAAW,EAAE,GAAG,IAAI,CAAC,CAACR,OAAO,EAAEW,KAAK,GAAG;MAAEO,KAAK,EAAEpB,YAAY,CAACa,KAAK;IAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9H,WAAW,MAAMQ,eAAe,IAAItB,qBAAqB,CAACmB,oBAAoB,CAAC,EAAE;MAC7E,MAAMG,eAAe;IACzB;EACJ;AACJ","ignoreList":[]}
@@ -79,6 +79,13 @@ describe("FetchMetadata", () => {
79
79
  "nullable": false,
80
80
  "type": "integer",
81
81
  },
82
+ "employeeLocation": {
83
+ "description": "Geotime series reference of the location of the employee",
84
+ "displayName": undefined,
85
+ "multiplicity": false,
86
+ "nullable": true,
87
+ "type": "geotimeSeriesReference",
88
+ },
82
89
  "employeeStatus": {
83
90
  "description": "TimeSeries of the status of the employee",
84
91
  "displayName": undefined,
@@ -1 +1 @@
1
- {"version":3,"file":"fetchMetadata.test.js","names":["$Actions","$Interfaces","$Objects","$ontologyRid","$Queries","apiServer","afterAll","beforeAll","describe","expect","expectTypeOf","it","createClient","client","listen","close","objectMetadata","fetchMetadata","Employee","toEqualTypeOf","toMatchInlineSnapshot","interfaceMetadata","FooInterface","actionMetadata","moveOffice","queryMetadata","queryAcceptsObject"],"sources":["fetchMetadata.test.js"],"sourcesContent":["/*\n * Copyright 2024 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 */\nimport { $Actions, $Interfaces, $Objects, $ontologyRid, $Queries, } from \"@osdk/client.test.ontology\";\nimport { apiServer } from \"@osdk/shared.test\";\nimport { afterAll, beforeAll, describe, expect, expectTypeOf, it, } from \"vitest\";\nimport { createClient } from \"./createClient.js\";\ndescribe(\"FetchMetadata\", () => {\n let client;\n beforeAll(async () => {\n apiServer.listen();\n client = createClient(\"https://stack.palantir.com\", $ontologyRid, async () => \"myAccessToken\");\n });\n afterAll(() => {\n apiServer.close();\n });\n it(\"fetches object metadata correctly\", async () => {\n const objectMetadata = await client.fetchMetadata($Objects.Employee);\n expectTypeOf(objectMetadata).toEqualTypeOf();\n expect(objectMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"Employee\",\n \"description\": \"A full-time or part-time \n\n employee of our firm\",\n \"displayName\": \"Employee\",\n \"icon\": {\n \"color\": \"blue\",\n \"name\": \"person\",\n \"type\": \"blueprint\",\n },\n \"implements\": [\n \"FooInterface\",\n ],\n \"interfaceMap\": {\n \"FooInterface\": {\n \"fooSpt\": \"fullName\",\n },\n },\n \"inverseInterfaceMap\": {\n \"FooInterface\": {\n \"fullName\": \"fooSpt\",\n },\n },\n \"links\": {\n \"lead\": {\n \"multiplicity\": false,\n \"targetType\": \"Employee\",\n },\n \"officeLink\": {\n \"multiplicity\": false,\n \"targetType\": \"Office\",\n },\n \"peeps\": {\n \"multiplicity\": true,\n \"targetType\": \"Employee\",\n },\n },\n \"pluralDisplayName\": \"Employees\",\n \"primaryKeyApiName\": \"employeeId\",\n \"primaryKeyType\": \"integer\",\n \"properties\": {\n \"employeeId\": {\n \"description\": undefined,\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": false,\n \"type\": \"integer\",\n },\n \"employeeStatus\": {\n \"description\": \"TimeSeries of the status of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"stringTimeseries\",\n },\n \"fullName\": {\n \"description\": undefined,\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"office\": {\n \"description\": \"The unique \"ID\" of the employee's \\\\\"primary\\\\\" assigned office.\n This is some more text.\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"startDate\": {\n \"description\": \"The date the employee was hired (most recently, if they were re-hired)\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"datetime\",\n },\n },\n \"rid\": \"ri.ontology.main.object-type.401ac022-89eb-4591-8b7e-0a912b9efb44\",\n \"status\": \"ACTIVE\",\n \"titleProperty\": \"fullName\",\n \"type\": \"object\",\n \"visibility\": \"NORMAL\",\n }\n `);\n });\n it(\"fetches interface metadata correctly\", async () => {\n const interfaceMetadata = await client.fetchMetadata($Interfaces.FooInterface);\n expectTypeOf(interfaceMetadata).toEqualTypeOf();\n expect(interfaceMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"FooInterface\",\n \"description\": \"Interface for Foo\",\n \"displayName\": \"Foo Interface\",\n \"implements\": [],\n \"links\": {},\n \"properties\": {\n \"fooSpt\": {\n \"description\": \"A foo\",\n \"displayName\": \"Foo\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n },\n \"rid\": \"ri.interface.main.interface.1\",\n \"type\": \"interface\",\n }\n `);\n });\n it(\"fetches action metadata correctly\", async () => {\n const actionMetadata = await client.fetchMetadata($Actions.moveOffice);\n expectTypeOf(actionMetadata).toEqualTypeOf();\n expect(actionMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"moveOffice\",\n \"description\": \"Update an office's physical location\",\n \"displayName\": \"move-office\",\n \"modifiedEntities\": {\n \"Office\": {\n \"created\": false,\n \"modified\": true,\n },\n },\n \"parameters\": {\n \"newAddress\": {\n \"description\": \"The office's new physical address (not necessarily shipping address)\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"newCapacity\": {\n \"description\": \"The maximum seated-at-desk capacity of the new office (maximum fire-safe capacity may be higher)\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"integer\",\n },\n \"officeId\": {\n \"description\": undefined,\n \"multiplicity\": false,\n \"nullable\": false,\n \"type\": \"string\",\n },\n \"officeNames\": {\n \"description\": \"A list of all office names\",\n \"multiplicity\": true,\n \"nullable\": true,\n \"type\": \"integer\",\n },\n },\n \"rid\": \"ri.ontology.main.action-type.9f84017d-cf17-4fa8-84c3-8e01e5d594f2\",\n \"status\": \"ACTIVE\",\n \"type\": \"action\",\n }\n `);\n });\n it(\"fetches query metadata correctly\", async () => {\n const queryMetadata = await client.fetchMetadata($Queries.queryAcceptsObject);\n expectTypeOf(queryMetadata).toEqualTypeOf();\n expect(queryMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"queryAcceptsObject\",\n \"description\": \"description of the query that takes object types\",\n \"displayName\": \"QueryAcceptsObject\",\n \"output\": {\n \"nullable\": false,\n \"object\": \"Employee\",\n \"type\": \"object\",\n },\n \"parameters\": {\n \"object\": {\n \"description\": undefined,\n \"nullable\": false,\n \"object\": \"Employee\",\n \"type\": \"object\",\n },\n },\n \"rid\": \"ri.function-registry.main.function.9b55870a-63c7-4d48-8f06-9627c0805968\",\n \"type\": \"query\",\n \"version\": \"0.11.0\",\n }\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,WAAW,EAAEC,QAAQ,EAAEC,YAAY,EAAEC,QAAQ,QAAS,4BAA4B;AACrG,SAASC,SAAS,QAAQ,mBAAmB;AAC7C,SAASC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,YAAY,EAAEC,EAAE,QAAS,QAAQ;AACjF,SAASC,YAAY,QAAQ,mBAAmB;AAChDJ,QAAQ,CAAC,eAAe,EAAE,MAAM;EAC5B,IAAIK,MAAM;EACVN,SAAS,CAAC,YAAY;IAClBF,SAAS,CAACS,MAAM,CAAC,CAAC;IAClBD,MAAM,GAAGD,YAAY,CAAC,4BAA4B,EAAET,YAAY,EAAE,YAAY,eAAe,CAAC;EAClG,CAAC,CAAC;EACFG,QAAQ,CAAC,MAAM;IACXD,SAAS,CAACU,KAAK,CAAC,CAAC;EACrB,CAAC,CAAC;EACFJ,EAAE,CAAC,mCAAmC,EAAE,YAAY;IAChD,MAAMK,cAAc,GAAG,MAAMH,MAAM,CAACI,aAAa,CAACf,QAAQ,CAACgB,QAAQ,CAAC;IACpER,YAAY,CAACM,cAAc,CAAC,CAACG,aAAa,CAAC,CAAC;IAC5CV,MAAM,CAACO,cAAc,CAAC,CAACI,qBAAqB,CAAC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACF,CAAC,CAAC;EACFT,EAAE,CAAC,sCAAsC,EAAE,YAAY;IACnD,MAAMU,iBAAiB,GAAG,MAAMR,MAAM,CAACI,aAAa,CAAChB,WAAW,CAACqB,YAAY,CAAC;IAC9EZ,YAAY,CAACW,iBAAiB,CAAC,CAACF,aAAa,CAAC,CAAC;IAC/CV,MAAM,CAACY,iBAAiB,CAAC,CAACD,qBAAqB,CAAC;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACF,CAAC,CAAC;EACFT,EAAE,CAAC,mCAAmC,EAAE,YAAY;IAChD,MAAMY,cAAc,GAAG,MAAMV,MAAM,CAACI,aAAa,CAACjB,QAAQ,CAACwB,UAAU,CAAC;IACtEd,YAAY,CAACa,cAAc,CAAC,CAACJ,aAAa,CAAC,CAAC;IAC5CV,MAAM,CAACc,cAAc,CAAC,CAACH,qBAAqB,CAAC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACF,CAAC,CAAC;EACFT,EAAE,CAAC,kCAAkC,EAAE,YAAY;IAC/C,MAAMc,aAAa,GAAG,MAAMZ,MAAM,CAACI,aAAa,CAACb,QAAQ,CAACsB,kBAAkB,CAAC;IAC7EhB,YAAY,CAACe,aAAa,CAAC,CAACN,aAAa,CAAC,CAAC;IAC3CV,MAAM,CAACgB,aAAa,CAAC,CAACL,qBAAqB,CAAC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACF,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"fetchMetadata.test.js","names":["$Actions","$Interfaces","$Objects","$ontologyRid","$Queries","apiServer","afterAll","beforeAll","describe","expect","expectTypeOf","it","createClient","client","listen","close","objectMetadata","fetchMetadata","Employee","toEqualTypeOf","toMatchInlineSnapshot","interfaceMetadata","FooInterface","actionMetadata","moveOffice","queryMetadata","queryAcceptsObject"],"sources":["fetchMetadata.test.js"],"sourcesContent":["/*\n * Copyright 2024 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 */\nimport { $Actions, $Interfaces, $Objects, $ontologyRid, $Queries, } from \"@osdk/client.test.ontology\";\nimport { apiServer } from \"@osdk/shared.test\";\nimport { afterAll, beforeAll, describe, expect, expectTypeOf, it, } from \"vitest\";\nimport { createClient } from \"./createClient.js\";\ndescribe(\"FetchMetadata\", () => {\n let client;\n beforeAll(async () => {\n apiServer.listen();\n client = createClient(\"https://stack.palantir.com\", $ontologyRid, async () => \"myAccessToken\");\n });\n afterAll(() => {\n apiServer.close();\n });\n it(\"fetches object metadata correctly\", async () => {\n const objectMetadata = await client.fetchMetadata($Objects.Employee);\n expectTypeOf(objectMetadata).toEqualTypeOf();\n expect(objectMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"Employee\",\n \"description\": \"A full-time or part-time \n\n employee of our firm\",\n \"displayName\": \"Employee\",\n \"icon\": {\n \"color\": \"blue\",\n \"name\": \"person\",\n \"type\": \"blueprint\",\n },\n \"implements\": [\n \"FooInterface\",\n ],\n \"interfaceMap\": {\n \"FooInterface\": {\n \"fooSpt\": \"fullName\",\n },\n },\n \"inverseInterfaceMap\": {\n \"FooInterface\": {\n \"fullName\": \"fooSpt\",\n },\n },\n \"links\": {\n \"lead\": {\n \"multiplicity\": false,\n \"targetType\": \"Employee\",\n },\n \"officeLink\": {\n \"multiplicity\": false,\n \"targetType\": \"Office\",\n },\n \"peeps\": {\n \"multiplicity\": true,\n \"targetType\": \"Employee\",\n },\n },\n \"pluralDisplayName\": \"Employees\",\n \"primaryKeyApiName\": \"employeeId\",\n \"primaryKeyType\": \"integer\",\n \"properties\": {\n \"employeeId\": {\n \"description\": undefined,\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": false,\n \"type\": \"integer\",\n },\n \"employeeLocation\": {\n \"description\": \"Geotime series reference of the location of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"geotimeSeriesReference\",\n },\n \"employeeStatus\": {\n \"description\": \"TimeSeries of the status of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"stringTimeseries\",\n },\n \"fullName\": {\n \"description\": undefined,\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"office\": {\n \"description\": \"The unique \"ID\" of the employee's \\\\\"primary\\\\\" assigned office.\n This is some more text.\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"startDate\": {\n \"description\": \"The date the employee was hired (most recently, if they were re-hired)\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"datetime\",\n },\n },\n \"rid\": \"ri.ontology.main.object-type.401ac022-89eb-4591-8b7e-0a912b9efb44\",\n \"status\": \"ACTIVE\",\n \"titleProperty\": \"fullName\",\n \"type\": \"object\",\n \"visibility\": \"NORMAL\",\n }\n `);\n });\n it(\"fetches interface metadata correctly\", async () => {\n const interfaceMetadata = await client.fetchMetadata($Interfaces.FooInterface);\n expectTypeOf(interfaceMetadata).toEqualTypeOf();\n expect(interfaceMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"FooInterface\",\n \"description\": \"Interface for Foo\",\n \"displayName\": \"Foo Interface\",\n \"implements\": [],\n \"links\": {},\n \"properties\": {\n \"fooSpt\": {\n \"description\": \"A foo\",\n \"displayName\": \"Foo\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n },\n \"rid\": \"ri.interface.main.interface.1\",\n \"type\": \"interface\",\n }\n `);\n });\n it(\"fetches action metadata correctly\", async () => {\n const actionMetadata = await client.fetchMetadata($Actions.moveOffice);\n expectTypeOf(actionMetadata).toEqualTypeOf();\n expect(actionMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"moveOffice\",\n \"description\": \"Update an office's physical location\",\n \"displayName\": \"move-office\",\n \"modifiedEntities\": {\n \"Office\": {\n \"created\": false,\n \"modified\": true,\n },\n },\n \"parameters\": {\n \"newAddress\": {\n \"description\": \"The office's new physical address (not necessarily shipping address)\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"newCapacity\": {\n \"description\": \"The maximum seated-at-desk capacity of the new office (maximum fire-safe capacity may be higher)\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"integer\",\n },\n \"officeId\": {\n \"description\": undefined,\n \"multiplicity\": false,\n \"nullable\": false,\n \"type\": \"string\",\n },\n \"officeNames\": {\n \"description\": \"A list of all office names\",\n \"multiplicity\": true,\n \"nullable\": true,\n \"type\": \"integer\",\n },\n },\n \"rid\": \"ri.ontology.main.action-type.9f84017d-cf17-4fa8-84c3-8e01e5d594f2\",\n \"status\": \"ACTIVE\",\n \"type\": \"action\",\n }\n `);\n });\n it(\"fetches query metadata correctly\", async () => {\n const queryMetadata = await client.fetchMetadata($Queries.queryAcceptsObject);\n expectTypeOf(queryMetadata).toEqualTypeOf();\n expect(queryMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"queryAcceptsObject\",\n \"description\": \"description of the query that takes object types\",\n \"displayName\": \"QueryAcceptsObject\",\n \"output\": {\n \"nullable\": false,\n \"object\": \"Employee\",\n \"type\": \"object\",\n },\n \"parameters\": {\n \"object\": {\n \"description\": undefined,\n \"nullable\": false,\n \"object\": \"Employee\",\n \"type\": \"object\",\n },\n },\n \"rid\": \"ri.function-registry.main.function.9b55870a-63c7-4d48-8f06-9627c0805968\",\n \"type\": \"query\",\n \"version\": \"0.11.0\",\n }\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,WAAW,EAAEC,QAAQ,EAAEC,YAAY,EAAEC,QAAQ,QAAS,4BAA4B;AACrG,SAASC,SAAS,QAAQ,mBAAmB;AAC7C,SAASC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,YAAY,EAAEC,EAAE,QAAS,QAAQ;AACjF,SAASC,YAAY,QAAQ,mBAAmB;AAChDJ,QAAQ,CAAC,eAAe,EAAE,MAAM;EAC5B,IAAIK,MAAM;EACVN,SAAS,CAAC,YAAY;IAClBF,SAAS,CAACS,MAAM,CAAC,CAAC;IAClBD,MAAM,GAAGD,YAAY,CAAC,4BAA4B,EAAET,YAAY,EAAE,YAAY,eAAe,CAAC;EAClG,CAAC,CAAC;EACFG,QAAQ,CAAC,MAAM;IACXD,SAAS,CAACU,KAAK,CAAC,CAAC;EACrB,CAAC,CAAC;EACFJ,EAAE,CAAC,mCAAmC,EAAE,YAAY;IAChD,MAAMK,cAAc,GAAG,MAAMH,MAAM,CAACI,aAAa,CAACf,QAAQ,CAACgB,QAAQ,CAAC;IACpER,YAAY,CAACM,cAAc,CAAC,CAACG,aAAa,CAAC,CAAC;IAC5CV,MAAM,CAACO,cAAc,CAAC,CAACI,qBAAqB,CAAC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACF,CAAC,CAAC;EACFT,EAAE,CAAC,sCAAsC,EAAE,YAAY;IACnD,MAAMU,iBAAiB,GAAG,MAAMR,MAAM,CAACI,aAAa,CAAChB,WAAW,CAACqB,YAAY,CAAC;IAC9EZ,YAAY,CAACW,iBAAiB,CAAC,CAACF,aAAa,CAAC,CAAC;IAC/CV,MAAM,CAACY,iBAAiB,CAAC,CAACD,qBAAqB,CAAC;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACF,CAAC,CAAC;EACFT,EAAE,CAAC,mCAAmC,EAAE,YAAY;IAChD,MAAMY,cAAc,GAAG,MAAMV,MAAM,CAACI,aAAa,CAACjB,QAAQ,CAACwB,UAAU,CAAC;IACtEd,YAAY,CAACa,cAAc,CAAC,CAACJ,aAAa,CAAC,CAAC;IAC5CV,MAAM,CAACc,cAAc,CAAC,CAACH,qBAAqB,CAAC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACF,CAAC,CAAC;EACFT,EAAE,CAAC,kCAAkC,EAAE,YAAY;IAC/C,MAAMc,aAAa,GAAG,MAAMZ,MAAM,CAACI,aAAa,CAACb,QAAQ,CAACsB,kBAAkB,CAAC;IAC7EhB,YAAY,CAACe,aAAa,CAAC,CAACN,aAAa,CAAC,CAAC;IAC3CV,MAAM,CAACgB,aAAa,CAAC,CAACL,qBAAqB,CAAC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACF,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
@@ -180,7 +180,7 @@ describe("AsyncCache", () => {
180
180
  for (let i = 0; i < asyncCacheSpies.get.mock.calls.length; i++) {
181
181
  if (asyncCacheSpies.get.mock.calls[i][1] === key) {
182
182
  expect(asyncCacheSpies.get.mock.settledResults[i].type).toBe("rejected");
183
- expect(asyncCacheSpies.get.mock.settledResults[i].value).toMatchInlineSnapshot(`[Error: aError]`);
183
+ expect(asyncCacheSpies.get.mock.settledResults[i].value).toMatchObject(new Error("aError"));
184
184
  }
185
185
  }
186
186
  });