@osdk/client 2.1.0-beta.2 → 2.1.0-beta.4
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 +39 -0
- package/build/browser/Client.d.ts +8 -21
- package/build/browser/Client.d.ts.map +1 -1
- package/build/browser/Client.js +2 -1
- package/build/browser/Client.js.map +1 -1
- package/build/browser/MinimalClientContext.d.ts +1 -1
- package/build/browser/MinimalClientContext.d.ts.map +1 -1
- package/build/browser/__unstable/ConjureSupport.js +4 -4
- package/build/browser/__unstable/ConjureSupport.js.map +1 -1
- package/build/browser/__unstable/createBulkLinksAsyncIterFactory.d.ts +1 -6
- package/build/browser/__unstable/createBulkLinksAsyncIterFactory.d.ts.map +1 -1
- package/build/browser/__unstable/createBulkLinksAsyncIterFactory.js +1 -1
- package/build/browser/__unstable/createBulkLinksAsyncIterFactory.js.map +1 -1
- package/build/browser/actions/applyAction.js +1 -1
- package/build/browser/actions/applyAction.js.map +1 -1
- package/build/browser/createClient.d.ts +1 -1
- package/build/browser/createClient.d.ts.map +1 -1
- package/build/browser/createClient.js +41 -19
- package/build/browser/createClient.js.map +1 -1
- package/build/browser/createGeotimeSeriesProperty.d.ts +1 -1
- package/build/browser/createGeotimeSeriesProperty.d.ts.map +1 -1
- package/build/browser/createGeotimeSeriesProperty.js +4 -1
- package/build/browser/createGeotimeSeriesProperty.js.map +1 -1
- package/build/browser/createMinimalClient.js +3 -3
- package/build/browser/createMinimalClient.js.map +1 -1
- package/build/browser/createPlatformClient.d.ts +1 -1
- package/build/browser/createPlatformClient.d.ts.map +1 -1
- package/build/browser/index.d.ts +0 -1
- package/build/browser/index.d.ts.map +1 -1
- package/build/browser/index.js +0 -1
- package/build/browser/index.js.map +1 -1
- package/build/browser/intellisense.test.js +1 -1
- package/build/browser/intellisense.test.js.map +1 -1
- package/build/browser/internal/conversions/legacyToModernSingleAggregationResult.js +1 -1
- package/build/browser/internal/conversions/legacyToModernSingleAggregationResult.js.map +1 -1
- package/build/browser/internal/conversions/modernToLegacyWhereClause.js +3 -3
- package/build/browser/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
- package/build/browser/object/aggregate.js +1 -1
- package/build/browser/object/aggregate.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/InterfaceHolder.d.ts +1 -10
- package/build/browser/object/convertWireToOsdkObjects/InterfaceHolder.d.ts.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.d.ts +0 -7
- package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.d.ts.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.js +6 -0
- package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js +7 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.js +2 -2
- package/build/browser/object/convertWireToOsdkObjects.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.test.js +10 -10
- package/build/browser/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/browser/object/fetchPage.js +1 -1
- package/build/browser/object/fetchPage.js.map +1 -1
- package/build/browser/objectSet/ObjectSet.test.js +43 -47
- package/build/browser/objectSet/ObjectSet.test.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js +62 -57
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js +109 -21
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
- package/build/browser/objectSet/createObjectSet.js +2 -5
- package/build/browser/objectSet/createObjectSet.js.map +1 -1
- package/build/browser/ontology/makeConjureContext.d.ts +1 -1
- package/build/browser/ontology/makeConjureContext.d.ts.map +1 -1
- package/build/browser/queries/applyQuery.js +1 -1
- package/build/browser/queries/applyQuery.js.map +1 -1
- package/build/browser/queries/queries.test.js +30 -2
- package/build/browser/queries/queries.test.js.map +1 -1
- package/build/browser/tsserver.js +1 -1
- package/build/browser/tsserver.js.map +1 -1
- package/build/browser/util/UserAgent.js +1 -1
- package/build/esm/Client.d.ts +8 -21
- package/build/esm/Client.d.ts.map +1 -1
- package/build/esm/Client.js +2 -1
- package/build/esm/Client.js.map +1 -1
- package/build/esm/MinimalClientContext.d.ts +1 -1
- package/build/esm/MinimalClientContext.d.ts.map +1 -1
- package/build/esm/__unstable/ConjureSupport.js +4 -4
- package/build/esm/__unstable/ConjureSupport.js.map +1 -1
- package/build/esm/__unstable/createBulkLinksAsyncIterFactory.d.ts +1 -6
- package/build/esm/__unstable/createBulkLinksAsyncIterFactory.d.ts.map +1 -1
- package/build/esm/__unstable/createBulkLinksAsyncIterFactory.js +1 -1
- package/build/esm/__unstable/createBulkLinksAsyncIterFactory.js.map +1 -1
- package/build/esm/actions/applyAction.js +1 -1
- package/build/esm/actions/applyAction.js.map +1 -1
- package/build/esm/createClient.d.ts +1 -1
- package/build/esm/createClient.d.ts.map +1 -1
- package/build/esm/createClient.js +41 -19
- package/build/esm/createClient.js.map +1 -1
- package/build/esm/createGeotimeSeriesProperty.d.ts +1 -1
- package/build/esm/createGeotimeSeriesProperty.d.ts.map +1 -1
- package/build/esm/createGeotimeSeriesProperty.js +4 -1
- package/build/esm/createGeotimeSeriesProperty.js.map +1 -1
- package/build/esm/createMinimalClient.js +3 -3
- package/build/esm/createMinimalClient.js.map +1 -1
- package/build/esm/createPlatformClient.d.ts +1 -1
- package/build/esm/createPlatformClient.d.ts.map +1 -1
- package/build/esm/index.d.ts +0 -1
- package/build/esm/index.d.ts.map +1 -1
- package/build/esm/index.js +0 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/intellisense.test.js +1 -1
- package/build/esm/intellisense.test.js.map +1 -1
- package/build/esm/internal/conversions/legacyToModernSingleAggregationResult.js +1 -1
- package/build/esm/internal/conversions/legacyToModernSingleAggregationResult.js.map +1 -1
- package/build/esm/internal/conversions/modernToLegacyWhereClause.js +3 -3
- package/build/esm/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
- package/build/esm/object/aggregate.js +1 -1
- package/build/esm/object/aggregate.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/InterfaceHolder.d.ts +1 -10
- package/build/esm/object/convertWireToOsdkObjects/InterfaceHolder.d.ts.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.d.ts +0 -7
- package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.d.ts.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.js +6 -0
- package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js +7 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.js +2 -2
- package/build/esm/object/convertWireToOsdkObjects.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.test.js +10 -10
- package/build/esm/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/esm/object/fetchPage.js +1 -1
- package/build/esm/object/fetchPage.js.map +1 -1
- package/build/esm/objectSet/ObjectSet.test.js +43 -47
- package/build/esm/objectSet/ObjectSet.test.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js +62 -57
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js +109 -21
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
- package/build/esm/objectSet/createObjectSet.js +2 -5
- package/build/esm/objectSet/createObjectSet.js.map +1 -1
- package/build/esm/ontology/makeConjureContext.d.ts +1 -1
- package/build/esm/ontology/makeConjureContext.d.ts.map +1 -1
- package/build/esm/queries/applyQuery.js +1 -1
- package/build/esm/queries/applyQuery.js.map +1 -1
- package/build/esm/queries/queries.test.js +30 -2
- package/build/esm/queries/queries.test.js.map +1 -1
- package/build/esm/tsserver.js +1 -1
- package/build/esm/tsserver.js.map +1 -1
- package/build/esm/util/UserAgent.js +1 -1
- package/package.json +14 -13
|
@@ -13,13 +13,16 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks, __EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet } from "@osdk/api/unstable";
|
|
17
|
-
import { symbolClientContext } from "@osdk/shared.client";
|
|
16
|
+
import { __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks, __EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet, __EXPERIMENTAL__NOT_SUPPORTED_YET_subscribe } from "@osdk/api/unstable";
|
|
17
|
+
import { symbolClientContext as oldSymbolClientContext } from "@osdk/shared.client";
|
|
18
|
+
import { symbolClientContext } from "@osdk/shared.client2";
|
|
18
19
|
import { createBulkLinksAsyncIterFactory } from "./__unstable/createBulkLinksAsyncIterFactory.js";
|
|
19
20
|
import { applyAction } from "./actions/applyAction.js";
|
|
21
|
+
import { additionalContext } from "./Client.js";
|
|
20
22
|
import { createMinimalClient } from "./createMinimalClient.js";
|
|
21
23
|
import { fetchMetadataInternal } from "./fetchMetadata.js";
|
|
22
|
-
import { createObjectSet } from "./objectSet/createObjectSet.js";
|
|
24
|
+
import { createObjectSet, getWireObjectSet } from "./objectSet/createObjectSet.js";
|
|
25
|
+
import { ObjectSetListenerWebsocket } from "./objectSet/ObjectSetListenerWebsocket.js";
|
|
23
26
|
import { applyQuery } from "./queries/applyQuery.js";
|
|
24
27
|
class ActionInvoker {
|
|
25
28
|
constructor(clientCtx, actionDef) {
|
|
@@ -65,29 +68,48 @@ baseUrl, ontologyRid, tokenProvider, options = undefined, fetchFn = fetch) {
|
|
|
65
68
|
return new ActionInvoker(clientCtx, o); // then as any for dealing with the conditional return value
|
|
66
69
|
} else if (o.type === "query") {
|
|
67
70
|
return new QueryInvoker(clientCtx, o);
|
|
71
|
+
} else if (o.type === "experiment") {
|
|
72
|
+
switch (o.name) {
|
|
73
|
+
case __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks.name:
|
|
74
|
+
return {
|
|
75
|
+
invoke: createBulkLinksAsyncIterFactory(clientCtx)
|
|
76
|
+
};
|
|
77
|
+
case __EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet.name:
|
|
78
|
+
return {
|
|
79
|
+
invoke: (definition, rid) => {
|
|
80
|
+
return createObjectSet(definition, client[additionalContext], {
|
|
81
|
+
type: "intersect",
|
|
82
|
+
objectSets: [{
|
|
83
|
+
type: "base",
|
|
84
|
+
objectType: definition.apiName
|
|
85
|
+
}, {
|
|
86
|
+
type: "reference",
|
|
87
|
+
reference: rid
|
|
88
|
+
}]
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
case __EXPERIMENTAL__NOT_SUPPORTED_YET_subscribe.name:
|
|
93
|
+
return {
|
|
94
|
+
invoke: (objectSet, properties, listener) => {
|
|
95
|
+
const pendingSubscribe = ObjectSetListenerWebsocket.getInstance(clientCtx).subscribe(objectSet.$objectSetInternals?.def, getWireObjectSet(objectSet), listener, properties);
|
|
96
|
+
return async () => (await pendingSubscribe)();
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
throw new Error("not implemented");
|
|
68
101
|
} else {
|
|
69
102
|
throw new Error("not implemented");
|
|
70
103
|
}
|
|
71
104
|
}, {
|
|
72
|
-
[
|
|
105
|
+
[oldSymbolClientContext]: {
|
|
73
106
|
value: clientCtx
|
|
74
107
|
},
|
|
75
|
-
[
|
|
76
|
-
|
|
108
|
+
[symbolClientContext]: {
|
|
109
|
+
value: clientCtx
|
|
77
110
|
},
|
|
78
|
-
[
|
|
79
|
-
|
|
80
|
-
return createObjectSet(definition, client[symbolClientContext], {
|
|
81
|
-
type: "intersect",
|
|
82
|
-
objectSets: [{
|
|
83
|
-
type: "base",
|
|
84
|
-
objectType: definition.apiName
|
|
85
|
-
}, {
|
|
86
|
-
type: "reference",
|
|
87
|
-
reference: rid
|
|
88
|
-
}]
|
|
89
|
-
});
|
|
90
|
-
}
|
|
111
|
+
[additionalContext]: {
|
|
112
|
+
value: clientCtx
|
|
91
113
|
},
|
|
92
114
|
fetchMetadata: {
|
|
93
115
|
value: fetchMetadata
|
|
@@ -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","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,IAAI,CAACG,gBAAgB,GAAGX,WAAW,CAACS,IAAI,CAACC,SAAS,EAAEH,SAAS,EAAEC,SAAS,CAAC;EAC7E;EACAR,WAAW;EACXW,gBAAgB;AACpB;AACA,MAAMC,YAAY,CAAC;EACfN,WAAWA,CAACC,SAAS,EAAEM,QAAQ,EAAE;IAC7B,IAAI,CAACC,eAAe,GAAGV,UAAU,CAACK,IAAI,CAACC,SAAS,EAAEH,SAAS,EAAEM,QAAQ,CAAC;EAC1E;EACAC,eAAe;AACnB;AACA;AACA,OAAO,SAASC,oBAAoBA,CAACC,gBAAgB;AAAE;AACvDC,OAAO,EAAEC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AAG;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":[]}
|
|
1
|
+
{"version":3,"file":"createClient.js","names":["__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks","__EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet","__EXPERIMENTAL__NOT_SUPPORTED_YET_subscribe","symbolClientContext","oldSymbolClientContext","createBulkLinksAsyncIterFactory","applyAction","additionalContext","createMinimalClient","fetchMetadataInternal","createObjectSet","getWireObjectSet","ObjectSetListenerWebsocket","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","name","invoke","definition","rid","objectSets","objectType","apiName","reference","objectSet","properties","listener","pendingSubscribe","getInstance","subscribe","$objectSetInternals","def","value","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, __EXPERIMENTAL__NOT_SUPPORTED_YET_subscribe, } from \"@osdk/api/unstable\";\nimport { symbolClientContext as oldSymbolClientContext } from \"@osdk/shared.client\";\nimport { symbolClientContext } from \"@osdk/shared.client2\";\nimport { createBulkLinksAsyncIterFactory } from \"./__unstable/createBulkLinksAsyncIterFactory.js\";\nimport { applyAction } from \"./actions/applyAction.js\";\nimport { additionalContext } from \"./Client.js\";\nimport { createMinimalClient } from \"./createMinimalClient.js\";\nimport { fetchMetadataInternal } from \"./fetchMetadata.js\";\nimport { createObjectSet, getWireObjectSet, } from \"./objectSet/createObjectSet.js\";\nimport { ObjectSetListenerWebsocket } from \"./objectSet/ObjectSetListenerWebsocket.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 if (o.type === \"experiment\") {\n switch (o.name) {\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks.name:\n return {\n invoke: createBulkLinksAsyncIterFactory(clientCtx),\n };\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet.name:\n return {\n invoke: (definition, rid) => {\n return createObjectSet(definition, client[additionalContext], {\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 case __EXPERIMENTAL__NOT_SUPPORTED_YET_subscribe.name:\n return {\n invoke: (objectSet, properties, listener) => {\n const pendingSubscribe = ObjectSetListenerWebsocket.getInstance(clientCtx).subscribe(objectSet.$objectSetInternals?.def, getWireObjectSet(objectSet), listener, properties);\n return async () => (await pendingSubscribe)();\n },\n };\n }\n throw new Error(\"not implemented\");\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 [oldSymbolClientContext]: {\n value: clientCtx,\n },\n [symbolClientContext]: {\n value: clientCtx,\n },\n [additionalContext]: {\n value: clientCtx,\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,EAAEC,2CAA2C,QAAS,oBAAoB;AAC3L,SAASC,mBAAmB,IAAIC,sBAAsB,QAAQ,qBAAqB;AACnF,SAASD,mBAAmB,QAAQ,sBAAsB;AAC1D,SAASE,+BAA+B,QAAQ,iDAAiD;AACjG,SAASC,WAAW,QAAQ,0BAA0B;AACtD,SAASC,iBAAiB,QAAQ,aAAa;AAC/C,SAASC,mBAAmB,QAAQ,0BAA0B;AAC9D,SAASC,qBAAqB,QAAQ,oBAAoB;AAC1D,SAASC,eAAe,EAAEC,gBAAgB,QAAS,gCAAgC;AACnF,SAASC,0BAA0B,QAAQ,2CAA2C;AACtF,SAASC,UAAU,QAAQ,yBAAyB;AACpD,MAAMC,aAAa,CAAC;EAChBC,WAAWA,CAACC,SAAS,EAAEC,SAAS,EAAE;IAC9B;IACA;IACA;IACA;IACA,IAAI,CAACX,WAAW,GAAGA,WAAW,CAACY,IAAI,CAACC,SAAS,EAAEH,SAAS,EAAEC,SAAS,CAAC;IACpE,IAAI,CAACG,gBAAgB,GAAGd,WAAW,CAACY,IAAI,CAACC,SAAS,EAAEH,SAAS,EAAEC,SAAS,CAAC;EAC7E;EACAX,WAAW;EACXc,gBAAgB;AACpB;AACA,MAAMC,YAAY,CAAC;EACfN,WAAWA,CAACC,SAAS,EAAEM,QAAQ,EAAE;IAC7B,IAAI,CAACC,eAAe,GAAGV,UAAU,CAACK,IAAI,CAACC,SAAS,EAAEH,SAAS,EAAEM,QAAQ,CAAC;EAC1E;EACAC,eAAe;AACnB;AACA;AACA,OAAO,SAASC,oBAAoBA,CAACC,gBAAgB;AAAE;AACvDC,OAAO,EAAEC,WAAW,EAAEC,aAAa,E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AM;AACjB;AACA,OAAO,MAAMsB,YAAY,GAAGlC,oBAAoB,CAACN,IAAI,CAACC,SAAS,EAAET,eAAe,CAAC","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@ import type { MinimalClient } from "./MinimalClientContext.js";
|
|
|
3
3
|
export declare class GeotimeSeriesPropertyImpl<T extends GeoJSON.Point> implements GeotimeSeriesProperty<T> {
|
|
4
4
|
#private;
|
|
5
5
|
lastFetchedValue: TimeSeriesPoint<T> | undefined;
|
|
6
|
-
constructor(client: MinimalClient, objectApiName: string, primaryKey: any, propertyName: string);
|
|
6
|
+
constructor(client: MinimalClient, objectApiName: string, primaryKey: any, propertyName: string, initialValue?: TimeSeriesPoint<T>);
|
|
7
7
|
getLatestValue(): Promise<TimeSeriesPoint<T> | undefined>;
|
|
8
8
|
getAllValues(query?: TimeSeriesQuery): Promise<TimeSeriesPoint<T>[]>;
|
|
9
9
|
asyncIterValues(query?: TimeSeriesQuery): AsyncGenerator<{
|
|
@@ -1 +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;
|
|
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,EACpB,YAAY,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC;IAStB,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"}
|
|
@@ -19,9 +19,12 @@ export class GeotimeSeriesPropertyImpl {
|
|
|
19
19
|
#triplet;
|
|
20
20
|
#client;
|
|
21
21
|
lastFetchedValue;
|
|
22
|
-
constructor(client, objectApiName, primaryKey, propertyName) {
|
|
22
|
+
constructor(client, objectApiName, primaryKey, propertyName, initialValue) {
|
|
23
23
|
this.#client = client;
|
|
24
24
|
this.#triplet = [objectApiName, primaryKey, propertyName];
|
|
25
|
+
if (initialValue != null) {
|
|
26
|
+
this.lastFetchedValue = initialValue;
|
|
27
|
+
}
|
|
25
28
|
}
|
|
26
29
|
async getLatestValue() {
|
|
27
30
|
const latestPointPromise = OntologiesV2.TimeSeriesValueBankProperties.getLatestValue(this.#client, await this.#client.ontologyRid, ...this.#triplet);
|
|
@@ -1 +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,yBAAyB,CAAC;EACnC,CAACC,OAAO;EACR,CAACC,MAAM;EACPC,gBAAgB;EAChBC,WAAWA,CAACF,MAAM,EAAEG,aAAa,EAAEC,UAAU,EAAEC,YAAY,EAAE;
|
|
1
|
+
{"version":3,"file":"createGeotimeSeriesProperty.js","names":["OntologiesV2","asyncIterPointsHelper","getTimeRange","GeotimeSeriesPropertyImpl","triplet","client","lastFetchedValue","constructor","objectApiName","primaryKey","propertyName","initialValue","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, initialValue) {\n this.#client = client;\n this.#triplet = [objectApiName, primaryKey, propertyName];\n if (initialValue != null) {\n this.lastFetchedValue = initialValue;\n }\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,yBAAyB,CAAC;EACnC,CAACC,OAAO;EACR,CAACC,MAAM;EACPC,gBAAgB;EAChBC,WAAWA,CAACF,MAAM,EAAEG,aAAa,EAAEC,UAAU,EAAEC,YAAY,EAAEC,YAAY,EAAE;IACvE,IAAI,CAAC,CAACN,MAAM,GAAGA,MAAM;IACrB,IAAI,CAAC,CAACD,OAAO,GAAG,CAACI,aAAa,EAAEC,UAAU,EAAEC,YAAY,CAAC;IACzD,IAAIC,YAAY,IAAI,IAAI,EAAE;MACtB,IAAI,CAACL,gBAAgB,GAAGK,YAAY;IACxC;EACJ;EACA,MAAMC,cAAcA,CAAA,EAAG;IACnB,MAAMC,kBAAkB,GAAGb,YAAY,CAACc,6BAA6B,CAChEF,cAAc,CAAC,IAAI,CAAC,CAACP,MAAM,EAAE,MAAM,IAAI,CAAC,CAACA,MAAM,CAACU,WAAW,EAAE,GAAG,IAAI,CAAC,CAACX,OAAO,CAAC;IACnFS,kBAAkB,CAACG,IAAI,CAACC,WAAW,IAAI,IAAI,CAACX,gBAAgB,GAAGW,WAAW,CAAC;IAC3E,OAAOJ,kBAAkB;EAC7B;EACA,MAAMK,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,MAAMxB,YAAY,CAC1Cc,6BAA6B,CAACW,YAAY,CAAC,IAAI,CAAC,CAACpB,MAAM,EAAE,MAAM,IAAI,CAAC,CAACA,MAAM,CAACU,WAAW,EAAE,GAAG,IAAI,CAAC,CAACX,OAAO,EAAEe,KAAK,GAAG;MAAEO,KAAK,EAAExB,YAAY,CAACiB,KAAK;IAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5J,WAAW,MAAMQ,eAAe,IAAI1B,qBAAqB,CAACuB,oBAAoB,CAAC,EAAE;MAC7E,MAAMG,eAAe;IACzB;EACJ;AACJ","ignoreList":[]}
|
|
@@ -19,7 +19,7 @@ import { createStandardOntologyProviderFactory } from "./ontology/StandardOntolo
|
|
|
19
19
|
import { USER_AGENT } from "./util/UserAgent.js";
|
|
20
20
|
/** @internal */
|
|
21
21
|
export function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory = createObjectSet) {
|
|
22
|
-
if (process
|
|
22
|
+
if (process.env.NODE_ENV !== "production") {
|
|
23
23
|
try {
|
|
24
24
|
new URL(baseUrl);
|
|
25
25
|
} catch (e) {
|
|
@@ -35,8 +35,8 @@ export function createMinimalClient(metadata, baseUrl, tokenProvider, options =
|
|
|
35
35
|
clientCacheKey: {},
|
|
36
36
|
requestContext: {}
|
|
37
37
|
};
|
|
38
|
-
return Object.assign(minimalClient, {
|
|
38
|
+
return Object.freeze(Object.assign(minimalClient, {
|
|
39
39
|
ontologyProvider: createStandardOntologyProviderFactory(options)(minimalClient)
|
|
40
|
-
});
|
|
40
|
+
}));
|
|
41
41
|
}
|
|
42
42
|
//# sourceMappingURL=createMinimalClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createMinimalClient.js","names":["createSharedClientContext","createObjectSet","createStandardOntologyProviderFactory","USER_AGENT","createMinimalClient","metadata","baseUrl","tokenProvider","options","fetchFn","global","fetch","objectSetFactory","process","env","NODE_ENV","URL","e","hint","startsWith","Error","minimalClient","ontologyRid","logger","clientCacheKey","requestContext","Object","assign","ontologyProvider"],"sources":["createMinimalClient.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 { createSharedClientContext } from \"@osdk/shared.client.impl\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport { createStandardOntologyProviderFactory, } from \"./ontology/StandardOntologyProvider.js\";\nimport { USER_AGENT } from \"./util/UserAgent.js\";\n/** @internal */\nexport function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory = createObjectSet) {\n if (process
|
|
1
|
+
{"version":3,"file":"createMinimalClient.js","names":["createSharedClientContext","createObjectSet","createStandardOntologyProviderFactory","USER_AGENT","createMinimalClient","metadata","baseUrl","tokenProvider","options","fetchFn","global","fetch","objectSetFactory","process","env","NODE_ENV","URL","e","hint","startsWith","Error","minimalClient","ontologyRid","logger","clientCacheKey","requestContext","Object","freeze","assign","ontologyProvider"],"sources":["createMinimalClient.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 { createSharedClientContext } from \"@osdk/shared.client.impl\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport { createStandardOntologyProviderFactory, } from \"./ontology/StandardOntologyProvider.js\";\nimport { USER_AGENT } from \"./util/UserAgent.js\";\n/** @internal */\nexport function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory = createObjectSet) {\n if (process.env.NODE_ENV !== \"production\") {\n try {\n new URL(baseUrl);\n }\n catch (e) {\n const hint = !baseUrl.startsWith(\"http://\") || !baseUrl.startsWith(\"https://\")\n ? \". Did you forget to add 'http://' or 'https://'?\"\n : \"\";\n throw new Error(`Invalid stack URL: ${baseUrl}${hint}`);\n }\n }\n const minimalClient = {\n ...createSharedClientContext(baseUrl, tokenProvider, USER_AGENT, fetchFn),\n objectSetFactory,\n ontologyRid: metadata.ontologyRid,\n logger: options.logger,\n clientCacheKey: {},\n requestContext: {},\n };\n return Object.freeze(Object.assign(minimalClient, {\n ontologyProvider: createStandardOntologyProviderFactory(options)(minimalClient),\n }));\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,yBAAyB,QAAQ,0BAA0B;AACpE,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SAASC,qCAAqC,QAAS,wCAAwC;AAC/F,SAASC,UAAU,QAAQ,qBAAqB;AAChD;AACA,OAAO,SAASC,mBAAmBA,CAACC,QAAQ,EAAEC,OAAO,EAAEC,aAAa,EAAEC,OAAO,GAAG,CAAC,CAAC,EAAEC,OAAO,GAAGC,MAAM,CAACC,KAAK,EAAEC,gBAAgB,GAAGX,eAAe,EAAE;EAC5I,IAAIY,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACvC,IAAI;MACA,IAAIC,GAAG,CAACV,OAAO,CAAC;IACpB,CAAC,CACD,OAAOW,CAAC,EAAE;MACN,MAAMC,IAAI,GAAG,CAACZ,OAAO,CAACa,UAAU,CAAC,SAAS,CAAC,IAAI,CAACb,OAAO,CAACa,UAAU,CAAC,UAAU,CAAC,GACxE,kDAAkD,GAClD,EAAE;MACR,MAAM,IAAIC,KAAK,CAAC,sBAAsBd,OAAO,GAAGY,IAAI,EAAE,CAAC;IAC3D;EACJ;EACA,MAAMG,aAAa,GAAG;IAClB,GAAGrB,yBAAyB,CAACM,OAAO,EAAEC,aAAa,EAAEJ,UAAU,EAAEM,OAAO,CAAC;IACzEG,gBAAgB;IAChBU,WAAW,EAAEjB,QAAQ,CAACiB,WAAW;IACjCC,MAAM,EAAEf,OAAO,CAACe,MAAM;IACtBC,cAAc,EAAE,CAAC,CAAC;IAClBC,cAAc,EAAE,CAAC;EACrB,CAAC;EACD,OAAOC,MAAM,CAACC,MAAM,CAACD,MAAM,CAACE,MAAM,CAACP,aAAa,EAAE;IAC9CQ,gBAAgB,EAAE3B,qCAAqC,CAACM,OAAO,CAAC,CAACa,aAAa;EAClF,CAAC,CAAC,CAAC;AACP","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPlatformClient.d.ts","sourceRoot":"","sources":["../../src/createPlatformClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createPlatformClient.d.ts","sourceRoot":"","sources":["../../src/createPlatformClient.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAGhE,MAAM,WAAW,cAAe,SAAQ,mBAAmB;CAAG;AAE9D;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EACpC,OAAO,GAAE,SAAqB,EAC9B,OAAO,GAAE,OAAO,UAAU,CAAC,KAAa,GACvC,cAAc,CAOhB"}
|
package/build/esm/index.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ export { isOk } from "@osdk/api";
|
|
|
3
3
|
export { PalantirApiError } from "@osdk/shared.net.errors";
|
|
4
4
|
export { ActionValidationError } from "./actions/ActionValidationError.js";
|
|
5
5
|
export type { Client } from "./Client.js";
|
|
6
|
-
export { createAttachmentFromRid } from "./createAttachmentFromRid.js";
|
|
7
6
|
export { createClient } from "./createClient.js";
|
|
8
7
|
export { createPlatformClient } from "./createPlatformClient.js";
|
|
9
8
|
export type { PlatformClient } from "./createPlatformClient.js";
|
package/build/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAgBA,YAAY,EACV,kBAAkB,EAClB,0BAA0B,EAC1B,wBAAwB,EACxB,kBAAkB,EAClB,uBAAuB,EACvB,SAAS,EACT,IAAI,EACJ,UAAU,EACV,UAAU,EACV,MAAM,EACN,WAAW,GACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAgBA,YAAY,EACV,kBAAkB,EAClB,0BAA0B,EAC1B,wBAAwB,EACxB,kBAAkB,EAClB,uBAAuB,EACvB,SAAS,EACT,IAAI,EACJ,UAAU,EACV,UAAU,EACV,MAAM,EACN,WAAW,GACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
|
package/build/esm/index.js
CHANGED
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
export { isOk } from "@osdk/api";
|
|
17
17
|
export { PalantirApiError } from "@osdk/shared.net.errors";
|
|
18
18
|
export { ActionValidationError } from "./actions/ActionValidationError.js";
|
|
19
|
-
export { createAttachmentFromRid } from "./createAttachmentFromRid.js";
|
|
20
19
|
export { createClient } from "./createClient.js";
|
|
21
20
|
export { createPlatformClient } from "./createPlatformClient.js";
|
|
22
21
|
export { createAttachmentUpload } from "./object/AttachmentUpload.js";
|
package/build/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["isOk","PalantirApiError","ActionValidationError","
|
|
1
|
+
{"version":3,"file":"index.js","names":["isOk","PalantirApiError","ActionValidationError","createClient","createPlatformClient","createAttachmentUpload"],"sources":["index.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 */\nexport { isOk } from \"@osdk/api\";\nexport { PalantirApiError } from \"@osdk/shared.net.errors\";\nexport { ActionValidationError } from \"./actions/ActionValidationError.js\";\nexport { createClient } from \"./createClient.js\";\nexport { createPlatformClient } from \"./createPlatformClient.js\";\nexport { createAttachmentUpload } from \"./object/AttachmentUpload.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,IAAI,QAAQ,WAAW;AAChC,SAASC,gBAAgB,QAAQ,yBAAyB;AAC1D,SAASC,qBAAqB,QAAQ,oCAAoC;AAC1E,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,sBAAsB,QAAQ,8BAA8B","ignoreList":[]}
|
|
@@ -52,7 +52,7 @@ describe("intellisense", () => {
|
|
|
52
52
|
const clientsPackageJson = findUpSync("package.json", {
|
|
53
53
|
cwd: import.meta.url
|
|
54
54
|
});
|
|
55
|
-
!(clientsPackageJson != null) ? invariant(false) : void 0;
|
|
55
|
+
!(clientsPackageJson != null) ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
|
|
56
56
|
packagesDir = path.join(path.dirname(clientsPackageJson), "..");
|
|
57
57
|
clientPackagePath = path.join(packagesDir, "client");
|
|
58
58
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intellisense.test.js","names":["findUpSync","path","invariant","ts","afterEach","beforeAll","beforeEach","describe","expect","it","vi","startTsServer","rootLogger","hoisted","pino","pinoPretty","EventEmitter","Promise","resolve","level","build","sync","timestampKey","undefined","errorLikeObjectKeys","errorProps","ignore","destination","write","a","at","slice","console","log","packagesDir","clientPackagePath","clientsPackageJson","cwd","import","meta","url","join","dirname","tsServer","intellisenseFilePath","task","name","sys","fileExists","toBeTruthy","sendOpenRequest","file","stop","timeout","resp","sendQuickInfoRequest","line","offset","body","documentation","toMatchInlineSnapshot"],"sources":["intellisense.test.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 */\nimport { findUpSync } from \"find-up\";\nimport * as path from \"node:path\";\nimport invariant from \"tiny-invariant\";\nimport * as ts from \"typescript\";\nimport { afterEach, beforeAll, beforeEach, describe, expect, it, vi, } from \"vitest\";\nimport { startTsServer } from \"./tsserver.js\";\n// it needs to be hoisted because its referenced from our mocked WebSocket\n// which must be hoisted to work\nconst rootLogger = await vi.hoisted(async () => {\n const pino = (await import(\"pino\")).pino;\n const pinoPretty = await import(\"pino-pretty\");\n const { EventEmitter } = await import(\"node:events\");\n class PinoConsoleLogDestination extends EventEmitter {\n write(a) {\n // remove trailing newline since console.log adds one\n if (a.at(-1) === \"\\n\")\n a = a.slice(0, -1);\n // This lets the test framework aggregate the logs per test, whereas direct to stdout does not\n console.log(a);\n }\n }\n return Promise.resolve(pino({ level: \"info\" }, (pinoPretty.build)({\n sync: true,\n timestampKey: undefined,\n errorLikeObjectKeys: [\"error\", \"err\", \"exception\"],\n errorProps: \"stack,cause,properties\",\n ignore: \"time,hostname,pid\",\n destination: new PinoConsoleLogDestination(),\n })));\n});\ndescribe(\"intellisense\", () => {\n let packagesDir;\n let clientPackagePath;\n beforeAll(() => {\n const clientsPackageJson = findUpSync(\"package.json\", {\n cwd: import.meta.url,\n });\n invariant(clientsPackageJson != null);\n packagesDir = path.join(path.dirname(clientsPackageJson), \"..\");\n clientPackagePath = path.join(packagesDir, \"client\");\n });\n let tsServer;\n let intellisenseFilePath;\n beforeEach(async (a) => {\n intellisenseFilePath = path.join(clientPackagePath, \"src\", \"intellisense.test.helpers\", `${a.task.name}.ts`);\n expect(ts.sys.fileExists(intellisenseFilePath)).toBeTruthy();\n tsServer = await startTsServer(rootLogger);\n await tsServer.sendOpenRequest({ file: intellisenseFilePath });\n });\n afterEach(async () => {\n tsServer.stop();\n tsServer = undefined;\n });\n it(\"callsQueryAcceptsObject\", { timeout: 20_000 }, async () => {\n const { resp } = await tsServer.sendQuickInfoRequest({\n file: intellisenseFilePath,\n line: 27,\n offset: 6,\n });\n expect(resp.body?.documentation).toMatchInlineSnapshot(`\"(no ontology metadata)\"`);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,SAAS;AACpC,OAAO,KAAKC,IAAI,MAAM,WAAW;AACjC,OAAOC,SAAS,MAAM,gBAAgB;AACtC,OAAO,KAAKC,EAAE,MAAM,YAAY;AAChC,SAASC,SAAS,EAAEC,SAAS,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAS,QAAQ;AACpF,SAASC,aAAa,QAAQ,eAAe;AAC7C;AACA;AACA,MAAMC,UAAU,GAAG,MAAMF,EAAE,CAACG,OAAO,CAAC,YAAY;EAC5C,MAAMC,IAAI,GAAG,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,EAAEA,IAAI;EACxC,MAAMC,UAAU,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC;EAC9C,MAAM;IAAEC;EAAa,CAAC,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC;EAUpD,OAAOC,OAAO,CAACC,OAAO,CAACJ,IAAI,CAAC;IAAEK,KAAK,EAAE;EAAO,CAAC,EAAGJ,UAAU,CAACK,KAAK,CAAE;IAC9DC,IAAI,EAAE,IAAI;IACVC,YAAY,EAAEC,SAAS;IACvBC,mBAAmB,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,WAAW,CAAC;IAClDC,UAAU,EAAE,wBAAwB;IACpCC,MAAM,EAAE,mBAAmB;IAC3BC,WAAW,EAAE,IAfjB,cAAwCX,YAAY,CAAC;MACjDY,KAAKA,CAACC,CAAC,EAAE;QACL;QACA,IAAIA,CAAC,CAACC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,EACjBD,CAAC,GAAGA,CAAC,CAACE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACtB;QACAC,OAAO,CAACC,GAAG,CAACJ,CAAC,CAAC;MAClB;IACJ,CAAC,CAO8C;EAC/C,CAAC,CAAC,CAAC,CAAC;AACR,CAAC,CAAC;AACFtB,QAAQ,CAAC,cAAc,EAAE,MAAM;EAC3B,IAAI2B,WAAW;EACf,IAAIC,iBAAiB;EACrB9B,SAAS,CAAC,MAAM;IACZ,MAAM+B,kBAAkB,GAAGpC,UAAU,CAAC,cAAc,EAAE;MAClDqC,GAAG,EAAEC,MAAM,CAACC,IAAI,CAACC;IACrB,CAAC,CAAC;IACF,EAAUJ,kBAAkB,IAAI,IAAI,
|
|
1
|
+
{"version":3,"file":"intellisense.test.js","names":["findUpSync","path","invariant","ts","afterEach","beforeAll","beforeEach","describe","expect","it","vi","startTsServer","rootLogger","hoisted","pino","pinoPretty","EventEmitter","Promise","resolve","level","build","sync","timestampKey","undefined","errorLikeObjectKeys","errorProps","ignore","destination","write","a","at","slice","console","log","packagesDir","clientPackagePath","clientsPackageJson","cwd","import","meta","url","process","env","NODE_ENV","join","dirname","tsServer","intellisenseFilePath","task","name","sys","fileExists","toBeTruthy","sendOpenRequest","file","stop","timeout","resp","sendQuickInfoRequest","line","offset","body","documentation","toMatchInlineSnapshot"],"sources":["intellisense.test.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 */\nimport { findUpSync } from \"find-up\";\nimport * as path from \"node:path\";\nimport invariant from \"tiny-invariant\";\nimport * as ts from \"typescript\";\nimport { afterEach, beforeAll, beforeEach, describe, expect, it, vi, } from \"vitest\";\nimport { startTsServer } from \"./tsserver.js\";\n// it needs to be hoisted because its referenced from our mocked WebSocket\n// which must be hoisted to work\nconst rootLogger = await vi.hoisted(async () => {\n const pino = (await import(\"pino\")).pino;\n const pinoPretty = await import(\"pino-pretty\");\n const { EventEmitter } = await import(\"node:events\");\n class PinoConsoleLogDestination extends EventEmitter {\n write(a) {\n // remove trailing newline since console.log adds one\n if (a.at(-1) === \"\\n\")\n a = a.slice(0, -1);\n // This lets the test framework aggregate the logs per test, whereas direct to stdout does not\n console.log(a);\n }\n }\n return Promise.resolve(pino({ level: \"info\" }, (pinoPretty.build)({\n sync: true,\n timestampKey: undefined,\n errorLikeObjectKeys: [\"error\", \"err\", \"exception\"],\n errorProps: \"stack,cause,properties\",\n ignore: \"time,hostname,pid\",\n destination: new PinoConsoleLogDestination(),\n })));\n});\ndescribe(\"intellisense\", () => {\n let packagesDir;\n let clientPackagePath;\n beforeAll(() => {\n const clientsPackageJson = findUpSync(\"package.json\", {\n cwd: import.meta.url,\n });\n invariant(clientsPackageJson != null);\n packagesDir = path.join(path.dirname(clientsPackageJson), \"..\");\n clientPackagePath = path.join(packagesDir, \"client\");\n });\n let tsServer;\n let intellisenseFilePath;\n beforeEach(async (a) => {\n intellisenseFilePath = path.join(clientPackagePath, \"src\", \"intellisense.test.helpers\", `${a.task.name}.ts`);\n expect(ts.sys.fileExists(intellisenseFilePath)).toBeTruthy();\n tsServer = await startTsServer(rootLogger);\n await tsServer.sendOpenRequest({ file: intellisenseFilePath });\n });\n afterEach(async () => {\n tsServer.stop();\n tsServer = undefined;\n });\n it(\"callsQueryAcceptsObject\", { timeout: 20_000 }, async () => {\n const { resp } = await tsServer.sendQuickInfoRequest({\n file: intellisenseFilePath,\n line: 27,\n offset: 6,\n });\n expect(resp.body?.documentation).toMatchInlineSnapshot(`\"(no ontology metadata)\"`);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,SAAS;AACpC,OAAO,KAAKC,IAAI,MAAM,WAAW;AACjC,OAAOC,SAAS,MAAM,gBAAgB;AACtC,OAAO,KAAKC,EAAE,MAAM,YAAY;AAChC,SAASC,SAAS,EAAEC,SAAS,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAS,QAAQ;AACpF,SAASC,aAAa,QAAQ,eAAe;AAC7C;AACA;AACA,MAAMC,UAAU,GAAG,MAAMF,EAAE,CAACG,OAAO,CAAC,YAAY;EAC5C,MAAMC,IAAI,GAAG,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,EAAEA,IAAI;EACxC,MAAMC,UAAU,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC;EAC9C,MAAM;IAAEC;EAAa,CAAC,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC;EAUpD,OAAOC,OAAO,CAACC,OAAO,CAACJ,IAAI,CAAC;IAAEK,KAAK,EAAE;EAAO,CAAC,EAAGJ,UAAU,CAACK,KAAK,CAAE;IAC9DC,IAAI,EAAE,IAAI;IACVC,YAAY,EAAEC,SAAS;IACvBC,mBAAmB,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,WAAW,CAAC;IAClDC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AAC,CAACK,UAAU,CAAC,CAAC;IAC5DN,QAAQ,GAAG,MAAMnC,aAAa,CAACC,UAAU,CAAC;IAC1C,MAAMkC,QAAQ,CAACO,eAAe,CAAC;MAAEC,IAAI,EAAEP;IAAqB,CAAC,CAAC;EAClE,CAAC,CAAC;EACF3C,SAAS,CAAC,YAAY;IAClB0C,QAAQ,CAACS,IAAI,CAAC,CAAC;IACfT,QAAQ,GAAGvB,SAAS;EACxB,CAAC,CAAC;EACFd,EAAE,CAAC,yBAAyB,EAAE;IAAE+C,OAAO,EAAE;EAAO,CAAC,EAAE,YAAY;IAC3D,MAAM;MAAEC;IAAK,CAAC,GAAG,MAAMX,QAAQ,CAACY,oBAAoB,CAAC;MACjDJ,IAAI,EAAEP,oBAAoB;MAC1BY,IAAI,EAAE,EAAE;MACRC,MAAM,EAAE;IACZ,CAAC,CAAC;IACFpD,MAAM,CAACiD,IAAI,CAACI,IAAI,EAAEC,aAAa,CAAC,CAACC,qBAAqB,CAAC,0BAA0B,CAAC;EACtF,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
|
|
@@ -21,7 +21,7 @@ export function legacyToModernSingleAggregationResult(entry) {
|
|
|
21
21
|
if (parts[0] === "count") {
|
|
22
22
|
return accumulator;
|
|
23
23
|
}
|
|
24
|
-
!(parts.length === 2) ? invariant(false, "assumed we were getting a `${key}.${type}`") : void 0;
|
|
24
|
+
!(parts.length === 2) ? process.env.NODE_ENV !== "production" ? invariant(false, "assumed we were getting a `${key}.${type}`") : invariant(false) : void 0;
|
|
25
25
|
const property = parts[0];
|
|
26
26
|
const metricType = parts[1];
|
|
27
27
|
if (!(property in accumulator)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacyToModernSingleAggregationResult.js","names":["invariant","legacyToModernSingleAggregationResult","entry","metrics","reduce","accumulator","curValue","parts","name","split","length","property","metricType","value"],"sources":["legacyToModernSingleAggregationResult.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 */\nimport invariant from \"tiny-invariant\";\n/** @internal */\nexport function legacyToModernSingleAggregationResult(entry) {\n return entry.metrics.reduce((accumulator, curValue) => {\n const parts = curValue.name.split(\".\");\n if (parts[0] === \"count\") {\n return accumulator;\n }\n invariant(parts.length === 2, \"assumed we were getting a `${key}.${type}`\");\n const property = parts[0];\n const metricType = parts[1];\n if (!(property in accumulator)) {\n accumulator[property] = {}; // fixme?\n }\n accumulator[property][metricType] = curValue.value; // fixme?\n return accumulator;\n }, {});\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,SAAS,MAAM,gBAAgB;AACtC;AACA,OAAO,SAASC,qCAAqCA,CAACC,KAAK,EAAE;EACzD,OAAOA,KAAK,CAACC,OAAO,CAACC,MAAM,CAAC,CAACC,WAAW,EAAEC,QAAQ,KAAK;IACnD,MAAMC,KAAK,GAAGD,QAAQ,CAACE,IAAI,CAACC,KAAK,CAAC,GAAG,CAAC;IACtC,IAAIF,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE;MACtB,OAAOF,WAAW;IACtB;IACA,EAAUE,KAAK,CAACG,MAAM,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"legacyToModernSingleAggregationResult.js","names":["invariant","legacyToModernSingleAggregationResult","entry","metrics","reduce","accumulator","curValue","parts","name","split","length","process","env","NODE_ENV","property","metricType","value"],"sources":["legacyToModernSingleAggregationResult.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 */\nimport invariant from \"tiny-invariant\";\n/** @internal */\nexport function legacyToModernSingleAggregationResult(entry) {\n return entry.metrics.reduce((accumulator, curValue) => {\n const parts = curValue.name.split(\".\");\n if (parts[0] === \"count\") {\n return accumulator;\n }\n invariant(parts.length === 2, \"assumed we were getting a `${key}.${type}`\");\n const property = parts[0];\n const metricType = parts[1];\n if (!(property in accumulator)) {\n accumulator[property] = {}; // fixme?\n }\n accumulator[property][metricType] = curValue.value; // fixme?\n return accumulator;\n }, {});\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,SAAS,MAAM,gBAAgB;AACtC;AACA,OAAO,SAASC,qCAAqCA,CAACC,KAAK,EAAE;EACzD,OAAOA,KAAK,CAACC,OAAO,CAACC,MAAM,CAAC,CAACC,WAAW,EAAEC,QAAQ,KAAK;IACnD,MAAMC,KAAK,GAAGD,QAAQ,CAACE,IAAI,CAACC,KAAK,CAAC,GAAG,CAAC;IACtC,IAAIF,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE;MACtB,OAAOF,WAAW;IACtB;IACA,EAAUE,KAAK,CAACG,MAAM,KAAK,CAAC,IAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAA5Bb,SAAS,QAAqB,4CAA4C,IAA1EA,SAAS;IACT,MAAMc,QAAQ,GAAGP,KAAK,CAAC,CAAC,CAAC;IACzB,MAAMQ,UAAU,GAAGR,KAAK,CAAC,CAAC,CAAC;IAC3B,IAAI,EAAEO,QAAQ,IAAIT,WAAW,CAAC,EAAE;MAC5BA,WAAW,CAACS,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAChC;IACAT,WAAW,CAACS,QAAQ,CAAC,CAACC,UAAU,CAAC,GAAGT,QAAQ,CAACU,KAAK,CAAC,CAAC;IACpD,OAAOX,WAAW;EACtB,CAAC,EAAE,CAAC,CAAC,CAAC;AACV","ignoreList":[]}
|
|
@@ -74,7 +74,7 @@ function makeGeoFilterPolygon(field, coordinates, filterType) {
|
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
76
|
function handleWherePair([field, filter], objectOrInterface) {
|
|
77
|
-
!(filter != null) ? invariant(false, "Defined key values are only allowed when they are not undefined.") : void 0;
|
|
77
|
+
!(filter != null) ? process.env.NODE_ENV !== "production" ? invariant(false, "Defined key values are only allowed when they are not undefined.") : invariant(false) : void 0;
|
|
78
78
|
if (typeof filter === "string" || typeof filter === "number" || typeof filter === "boolean") {
|
|
79
79
|
if (objectOrInterface.type === "interface") {
|
|
80
80
|
const [objApiNamespace] = extractNamespace(objectOrInterface.apiName);
|
|
@@ -93,13 +93,13 @@ function handleWherePair([field, filter], objectOrInterface) {
|
|
|
93
93
|
// If any of the keys start with `$` then they must be the only one.
|
|
94
94
|
// e.g. `where({ name: { $eq: "foo", $ne: "bar" } })` is invalid currently
|
|
95
95
|
const hasDollarSign = keysOfFilter.some(key => key.startsWith("$"));
|
|
96
|
-
!(!hasDollarSign || keysOfFilter.length === 1) ? invariant(false, "WhereClause Filter with multiple clauses isn't allowed") : void 0;
|
|
96
|
+
!(!hasDollarSign || keysOfFilter.length === 1) ? process.env.NODE_ENV !== "production" ? invariant(false, "WhereClause Filter with multiple clauses isn't allowed") : invariant(false) : void 0;
|
|
97
97
|
if (!hasDollarSign) {
|
|
98
98
|
// Future case for structs
|
|
99
99
|
throw new Error(`Unsupported filter. Did you forget to use a $-prefixed filter? (${JSON.stringify(filter)})`);
|
|
100
100
|
}
|
|
101
101
|
const firstKey = keysOfFilter[0];
|
|
102
|
-
!(filter[firstKey] != null) ? invariant(false) : void 0;
|
|
102
|
+
!(filter[firstKey] != null) ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
|
|
103
103
|
if (firstKey === "$ne") {
|
|
104
104
|
return {
|
|
105
105
|
type: "not",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modernToLegacyWhereClause.js","names":["DistanceUnitMapping","invariant","extractNamespace","fqApiName","last","lastIndexOf","undefined","slice","modernToLegacyWhereClause","whereClause","objectOrInterface","type","value","$and","map","clause","$or","$not","parts","Object","entries","length","handleWherePair","v","makeGeoFilterBbox","field","bbox","filterType","topLeft","coordinates","bottomRight","makeGeoFilterPolygon","filter","objApiNamespace","apiName","fieldApiNamespace","fieldShortName","keysOfFilter","keys","hasDollarSign","some","key","startsWith","Error","JSON","stringify","firstKey","withinBody","Array","isArray","$bbox","$distance","$of","center","distance","unit","$polygon","intersectsBody","substring"],"sources":["modernToLegacyWhereClause.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 */\nimport { DistanceUnitMapping } from \"@osdk/api\";\nimport invariant from \"tiny-invariant\";\nexport function extractNamespace(fqApiName) {\n const last = fqApiName.lastIndexOf(\".\");\n if (last === -1)\n return [undefined, fqApiName];\n return [fqApiName.slice(0, last), fqApiName.slice(last + 1)];\n}\n/** @internal */\nexport function modernToLegacyWhereClause(whereClause, objectOrInterface) {\n if (\"$and\" in whereClause) {\n return {\n type: \"and\",\n value: whereClause.$and.map((clause) => modernToLegacyWhereClause(clause, objectOrInterface)),\n };\n }\n else if (\"$or\" in whereClause) {\n return {\n type: \"or\",\n value: whereClause.$or.map((clause) => modernToLegacyWhereClause(clause, objectOrInterface)),\n };\n }\n else if (\"$not\" in whereClause) {\n return {\n type: \"not\",\n value: modernToLegacyWhereClause(whereClause.$not, objectOrInterface),\n };\n }\n const parts = Object.entries(whereClause);\n if (parts.length === 1) {\n return handleWherePair(parts[0], objectOrInterface);\n }\n return {\n type: \"and\",\n value: parts.map(v => handleWherePair(v, objectOrInterface)),\n };\n}\nfunction makeGeoFilterBbox(field, bbox, filterType) {\n return {\n type: filterType === \"$within\"\n ? \"withinBoundingBox\"\n : \"intersectsBoundingBox\",\n field,\n value: {\n topLeft: {\n type: \"Point\",\n coordinates: [bbox[0], bbox[3]],\n },\n bottomRight: {\n type: \"Point\",\n coordinates: [bbox[2], bbox[1]],\n },\n },\n };\n}\nfunction makeGeoFilterPolygon(field, coordinates, filterType) {\n return {\n type: filterType,\n field,\n value: {\n type: \"Polygon\",\n coordinates,\n },\n };\n}\nfunction handleWherePair([field, filter], objectOrInterface) {\n invariant(filter != null, \"Defined key values are only allowed when they are not undefined.\");\n if (typeof filter === \"string\" || typeof filter === \"number\"\n || typeof filter === \"boolean\") {\n if (objectOrInterface.type === \"interface\") {\n const [objApiNamespace] = extractNamespace(objectOrInterface.apiName);\n const [fieldApiNamespace, fieldShortName] = extractNamespace(field);\n if (fieldApiNamespace == null && objApiNamespace != null) {\n field = `${objApiNamespace}.${fieldShortName}`;\n }\n }\n return {\n type: \"eq\",\n field,\n value: filter,\n };\n }\n const keysOfFilter = Object.keys(filter);\n // If any of the keys start with `$` then they must be the only one.\n // e.g. `where({ name: { $eq: \"foo\", $ne: \"bar\" } })` is invalid currently\n const hasDollarSign = keysOfFilter.some((key) => key.startsWith(\"$\"));\n invariant(!hasDollarSign\n || keysOfFilter.length === 1, \"WhereClause Filter with multiple clauses isn't allowed\");\n if (!hasDollarSign) {\n // Future case for structs\n throw new Error(`Unsupported filter. Did you forget to use a $-prefixed filter? (${JSON.stringify(filter)})`);\n }\n const firstKey = keysOfFilter[0];\n invariant(filter[firstKey] != null);\n if (firstKey === \"$ne\") {\n return {\n type: \"not\",\n value: {\n type: \"eq\",\n field,\n value: filter[firstKey],\n },\n };\n }\n if (firstKey === \"$within\") {\n const withinBody = filter[firstKey];\n if (Array.isArray(withinBody)) {\n return makeGeoFilterBbox(field, withinBody, firstKey);\n }\n else if (\"$bbox\" in withinBody && withinBody.$bbox != null) {\n return makeGeoFilterBbox(field, withinBody.$bbox, firstKey);\n }\n else if ((\"$distance\" in withinBody && \"$of\" in withinBody)\n && withinBody.$distance != null\n && withinBody.$of != null) {\n return {\n type: \"withinDistanceOf\",\n field,\n value: {\n center: Array.isArray(withinBody.$of)\n ? {\n type: \"Point\",\n coordinates: withinBody.$of,\n }\n : withinBody.$of,\n distance: {\n value: withinBody.$distance[0],\n unit: DistanceUnitMapping[withinBody.$distance[1]],\n },\n },\n };\n }\n else {\n const coordinates = (\"$polygon\" in withinBody)\n ? withinBody.$polygon\n : withinBody.coordinates;\n return makeGeoFilterPolygon(field, coordinates, \"withinPolygon\");\n }\n }\n if (firstKey === \"$intersects\") {\n const intersectsBody = filter[firstKey];\n if (Array.isArray(intersectsBody)) {\n return makeGeoFilterBbox(field, intersectsBody, firstKey);\n }\n else if (\"$bbox\" in intersectsBody && intersectsBody.$bbox != null) {\n return makeGeoFilterBbox(field, intersectsBody.$bbox, firstKey);\n }\n else {\n const coordinates = (\"$polygon\" in intersectsBody)\n ? intersectsBody.$polygon\n : intersectsBody.coordinates;\n return makeGeoFilterPolygon(field, coordinates, \"intersectsPolygon\");\n }\n }\n return {\n type: firstKey.substring(1),\n field,\n value: filter[firstKey],\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,mBAAmB,QAAQ,WAAW;AAC/C,OAAOC,SAAS,MAA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MjB,WAAW,GAAI,UAAU,IAAI4B,cAAc,GAC3CA,cAAc,CAACD,QAAQ,GACvBC,cAAc,CAAC5B,WAAW;MAChC,OAAOE,oBAAoB,CAACN,KAAK,EAAEI,WAAW,EAAE,mBAAmB,CAAC;IACxE;EACJ;EACA,OAAO;IACHlB,IAAI,EAAEmC,QAAQ,CAACY,SAAS,CAAC,CAAC,CAAC;IAC3BjC,KAAK;IACLb,KAAK,EAAEoB,MAAM,CAACc,QAAQ;EAC1B,CAAC;AACL","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"modernToLegacyWhereClause.js","names":["DistanceUnitMapping","invariant","extractNamespace","fqApiName","last","lastIndexOf","undefined","slice","modernToLegacyWhereClause","whereClause","objectOrInterface","type","value","$and","map","clause","$or","$not","parts","Object","entries","length","handleWherePair","v","makeGeoFilterBbox","field","bbox","filterType","topLeft","coordinates","bottomRight","makeGeoFilterPolygon","filter","process","env","NODE_ENV","objApiNamespace","apiName","fieldApiNamespace","fieldShortName","keysOfFilter","keys","hasDollarSign","some","key","startsWith","Error","JSON","stringify","firstKey","withinBody","Array","isArray","$bbox","$distance","$of","center","distance","unit","$polygon","intersectsBody","substring"],"sources":["modernToLegacyWhereClause.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 */\nimport { DistanceUnitMapping } from \"@osdk/api\";\nimport invariant from \"tiny-invariant\";\nexport function extractNamespace(fqApiName) {\n const last = fqApiName.lastIndexOf(\".\");\n if (last === -1)\n return [undefined, fqApiName];\n return [fqApiName.slice(0, last), fqApiName.slice(last + 1)];\n}\n/** @internal */\nexport function modernToLegacyWhereClause(whereClause, objectOrInterface) {\n if (\"$and\" in whereClause) {\n return {\n type: \"and\",\n value: whereClause.$and.map((clause) => modernToLegacyWhereClause(clause, objectOrInterface)),\n };\n }\n else if (\"$or\" in whereClause) {\n return {\n type: \"or\",\n value: whereClause.$or.map((clause) => modernToLegacyWhereClause(clause, objectOrInterface)),\n };\n }\n else if (\"$not\" in whereClause) {\n return {\n type: \"not\",\n value: modernToLegacyWhereClause(whereClause.$not, objectOrInterface),\n };\n }\n const parts = Object.entries(whereClause);\n if (parts.length === 1) {\n return handleWherePair(parts[0], objectOrInterface);\n }\n return {\n type: \"and\",\n value: parts.map(v => handleWherePair(v, objectOrInterface)),\n };\n}\nfunction makeGeoFilterBbox(field, bbox, filterType) {\n return {\n type: filterType === \"$within\"\n ? \"withinBoundingBox\"\n : \"intersectsBoundingBox\",\n field,\n value: {\n topLeft: {\n type: \"Point\",\n coordinates: [bbox[0], bbox[3]],\n },\n bottomRight: {\n type: \"Point\",\n coordinates: [bbox[2], bbox[1]],\n },\n },\n };\n}\nfunction makeGeoFilterPolygon(field, coordinates, filterType) {\n return {\n type: filterType,\n field,\n value: {\n type: \"Polygon\",\n coordinates,\n },\n };\n}\nfunction handleWherePair([field, filter], objectOrInterface) {\n invariant(filter != null, \"Defined key values are only allowed when they are not undefined.\");\n if (typeof filter === \"string\" || typeof filter === \"number\"\n || typeof filter === \"boolean\") {\n if (objectOrInterface.type === \"interface\") {\n const [objApiNamespace] = extractNamespace(objectOrInterface.apiName);\n const [fieldApiNamespace, fieldShortName] = extractNamespace(field);\n if (fieldApiNamespace == null && objApiNamespace != null) {\n field = `${objApiNamespace}.${fieldShortName}`;\n }\n }\n return {\n type: \"eq\",\n field,\n value: filter,\n };\n }\n const keysOfFilter = Object.keys(filter);\n // If any of the keys start with `$` then they must be the only one.\n // e.g. `where({ name: { $eq: \"foo\", $ne: \"bar\" } })` is invalid currently\n const hasDollarSign = keysOfFilter.some((key) => key.startsWith(\"$\"));\n invariant(!hasDollarSign\n || keysOfFilter.length === 1, \"WhereClause Filter with multiple clauses isn't allowed\");\n if (!hasDollarSign) {\n // Future case for structs\n throw new Error(`Unsupported filter. Did you forget to use a $-prefixed filter? (${JSON.stringify(filter)})`);\n }\n const firstKey = keysOfFilter[0];\n invariant(filter[firstKey] != null);\n if (firstKey === \"$ne\") {\n return {\n type: \"not\",\n value: {\n type: \"eq\",\n field,\n value: filter[firstKey],\n },\n };\n }\n if (firstKey === \"$within\") {\n const withinBody = filter[firstKey];\n if (Array.isArray(withinBody)) {\n return makeGeoFilterBbox(field, withinBody, firstKey);\n }\n else if (\"$bbox\" in withinBody && withinBody.$bbox != null) {\n return makeGeoFilterBbox(field, withinBody.$bbox, firstKey);\n }\n else if ((\"$distance\" in withinBody && \"$of\" in withinBody)\n && withinBody.$distance != null\n && withinBody.$of != null) {\n return {\n type: \"withinDistanceOf\",\n field,\n value: {\n center: Array.isArray(withinBody.$of)\n ? {\n type: \"Point\",\n coordinates: withinBody.$of,\n }\n : withinBody.$of,\n distance: {\n value: withinBody.$distance[0],\n unit: DistanceUnitMapping[withinBody.$distance[1]],\n },\n },\n };\n }\n else {\n const coordinates = (\"$polygon\" in withinBody)\n ? withinBody.$polygon\n : withinBody.coordinates;\n return makeGeoFilterPolygon(field, coordinates, \"withinPolygon\");\n }\n }\n if (firstKey === \"$intersects\") {\n const intersectsBody = filter[firstKey];\n if (Array.isArray(intersectsBody)) {\n return makeGeoFilterBbox(field, intersectsBody, firstKey);\n }\n else if (\"$bbox\" in intersectsBody && intersectsBody.$bbox != null) {\n return makeGeoFilterBbox(field, intersectsBody.$bbox, firstKey);\n }\n else {\n const coordinates = (\"$polygon\" in intersectsBody)\n ? intersectsBody.$polygon\n : intersectsBody.coordinates;\n return makeGeoFilterPolygon(field, coordinates, \"intersectsPolygon\");\n }\n }\n return {\n type: firstKey.substring(1),\n field,\n value: filter[firstKey],\n };\n}\n"],"mappings":"AAAA;AACA;AACA;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c,CAAC,EAAE;MAC/B,OAAOpC,iBAAiB,CAACC,KAAK,EAAEmC,cAAc,EAAEX,QAAQ,CAAC;IAC7D,CAAC,MACI,IAAI,OAAO,IAAIW,cAAc,IAAIA,cAAc,CAACP,KAAK,IAAI,IAAI,EAAE;MAChE,OAAO7B,iBAAiB,CAACC,KAAK,EAAEmC,cAAc,CAACP,KAAK,EAAEJ,QAAQ,CAAC;IACnE,CAAC,MACI;MACD,MAAMpB,WAAW,GAAI,UAAU,IAAI+B,cAAc,GAC3CA,cAAc,CAACD,QAAQ,GACvBC,cAAc,CAAC/B,WAAW;MAChC,OAAOE,oBAAoB,CAACN,KAAK,EAAEI,WAAW,EAAE,mBAAmB,CAAC;IACxE;EACJ;EACA,OAAO;IACHlB,IAAI,EAAEsC,QAAQ,CAACY,SAAS,CAAC,CAAC,CAAC;IAC3BpC,KAAK;IACLb,KAAK,EAAEoB,MAAM,CAACiB,QAAQ;EAC1B,CAAC;AACL","ignoreList":[]}
|
|
@@ -42,7 +42,7 @@ export async function aggregate(clientCtx, objectType, objectSet = {
|
|
|
42
42
|
aggregation: body.aggregation
|
|
43
43
|
});
|
|
44
44
|
if (!req.$groupBy) {
|
|
45
|
-
!(result.data.length === 1) ? invariant(false, "no group by clause should mean only one data result") : void 0;
|
|
45
|
+
!(result.data.length === 1) ? process.env.NODE_ENV !== "production" ? invariant(false, "no group by clause should mean only one data result") : invariant(false) : void 0;
|
|
46
46
|
return {
|
|
47
47
|
...aggregationToCountResult(result.data[0]),
|
|
48
48
|
...legacyToModernSingleAggregationResult(result.data[0])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregate.js","names":["OntologiesV2","invariant","legacyToModernSingleAggregationResult","modernToLegacyAggregationClause","modernToLegacyGroupByClause","modernToLegacyWhereClause","addUserAgentAndRequestContextHeaders","aggregate","clientCtx","objectType","objectSet","type","req","body","aggregation","$select","groupBy","where","undefined","$groupBy","$where","result","OntologyObjectSets","ontologyRid","data","length","aggregationToCountResult","ret","map","entry","$group","group","aggregateResult","metrics","name","$count","value"],"sources":["aggregate.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 */\nimport * as OntologiesV2 from \"@osdk/internal.foundry.ontologiesv2\";\nimport invariant from \"tiny-invariant\";\nimport { legacyToModernSingleAggregationResult } from \"../internal/conversions/legacyToModernSingleAggregationResult.js\";\nimport { modernToLegacyAggregationClause } from \"../internal/conversions/modernToLegacyAggregationClause.js\";\nimport { modernToLegacyGroupByClause } from \"../internal/conversions/modernToLegacyGroupByClause.js\";\nimport { modernToLegacyWhereClause } from \"../internal/conversions/modernToLegacyWhereClause.js\";\nimport { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\n/** @internal */\nexport async function aggregate(clientCtx, objectType, objectSet = {\n type: \"base\",\n objectType: objectType[\"apiName\"],\n}, req) {\n const body = {\n aggregation: modernToLegacyAggregationClause(req.$select),\n groupBy: [],\n where: undefined,\n };\n if (req.$groupBy) {\n body.groupBy = modernToLegacyGroupByClause(req.$groupBy);\n }\n if (req.$where) {\n body.where = modernToLegacyWhereClause(req.$where, objectType);\n }\n const result = await OntologiesV2.OntologyObjectSets.aggregate(addUserAgentAndRequestContextHeaders(clientCtx, objectType), await clientCtx.ontologyRid, {\n objectSet,\n groupBy: body.groupBy,\n aggregation: body.aggregation,\n });\n if (!req.$groupBy) {\n invariant(result.data.length === 1, \"no group by clause should mean only one data result\");\n return {\n ...aggregationToCountResult(result.data[0]),\n ...legacyToModernSingleAggregationResult(result.data[0]),\n };\n }\n const ret = result.data\n .map((entry) => {\n return {\n $group: entry.group,\n ...aggregationToCountResult(entry),\n ...legacyToModernSingleAggregationResult(entry),\n };\n }); // fixme\n return ret; // FIXME\n}\nfunction aggregationToCountResult(entry) {\n for (const aggregateResult of entry.metrics) {\n if (aggregateResult.name === \"count\") {\n return { $count: aggregateResult.value };\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,OAAOC,SAAS,MAAM,gBAAgB;AACtC,SAASC,qCAAqC,QAAQ,kEAAkE;AACxH,SAASC,+BAA+B,QAAQ,4DAA4D;AAC5G,SAASC,2BAA2B,QAAQ,wDAAwD;AACpG,SAASC,yBAAyB,QAAQ,sDAAsD;AAChG,SAASC,oCAAoC,QAAQ,iDAAiD;AACtG;AACA,OAAO,eAAeC,SAASA,CAACC,SAAS,EAAEC,UAAU,EAAEC,SAAS,GAAG;EAC/DC,IAAI,EAAE,MAAM;EACZF,UAAU,EAAEA,UAAU,CAAC,SAAS;AACpC,CAAC,EAAEG,GAAG,EAAE;EACJ,MAAMC,IAAI,GAAG;IACTC,WAAW,EAAEX,+BAA+B,CAACS,GAAG,CAACG,OAAO,CAAC;IACzDC,OAAO,EAAE,EAAE;IACXC,KAAK,EAAEC;EACX,CAAC;EACD,IAAIN,GAAG,CAACO,QAAQ,EAAE;IACdN,IAAI,CAACG,OAAO,GAAGZ,2BAA2B,CAACQ,GAAG,CAACO,QAAQ,CAAC;EAC5D;EACA,IAAIP,GAAG,CAACQ,MAAM,EAAE;IACZP,IAAI,CAACI,KAAK,GAAGZ,yBAAyB,CAACO,GAAG,CAACQ,MAAM,EAAEX,UAAU,CAAC;EAClE;EACA,MAAMY,MAAM,GAAG,MAAMrB,YAAY,CAACsB,kBAAkB,CAACf,SAAS,CAACD,oCAAoC,CAACE,SAAS,EAAEC,UAAU,CAAC,EAAE,MAAMD,SAAS,CAACe,WAAW,EAAE;IACrJb,SAAS;IACTM,OAAO,EAAEH,IAAI,CAACG,OAAO;IACrBF,WAAW,EAAED,IAAI,CAACC;EACtB,CAAC,CAAC;EACF,IAAI,CAACF,GAAG,CAACO,QAAQ,EAAE;IACf,EAAUE,MAAM,CAACG,IAAI,CAACC,MAAM,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"aggregate.js","names":["OntologiesV2","invariant","legacyToModernSingleAggregationResult","modernToLegacyAggregationClause","modernToLegacyGroupByClause","modernToLegacyWhereClause","addUserAgentAndRequestContextHeaders","aggregate","clientCtx","objectType","objectSet","type","req","body","aggregation","$select","groupBy","where","undefined","$groupBy","$where","result","OntologyObjectSets","ontologyRid","data","length","process","env","NODE_ENV","aggregationToCountResult","ret","map","entry","$group","group","aggregateResult","metrics","name","$count","value"],"sources":["aggregate.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 */\nimport * as OntologiesV2 from \"@osdk/internal.foundry.ontologiesv2\";\nimport invariant from \"tiny-invariant\";\nimport { legacyToModernSingleAggregationResult } from \"../internal/conversions/legacyToModernSingleAggregationResult.js\";\nimport { modernToLegacyAggregationClause } from \"../internal/conversions/modernToLegacyAggregationClause.js\";\nimport { modernToLegacyGroupByClause } from \"../internal/conversions/modernToLegacyGroupByClause.js\";\nimport { modernToLegacyWhereClause } from \"../internal/conversions/modernToLegacyWhereClause.js\";\nimport { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\n/** @internal */\nexport async function aggregate(clientCtx, objectType, objectSet = {\n type: \"base\",\n objectType: objectType[\"apiName\"],\n}, req) {\n const body = {\n aggregation: modernToLegacyAggregationClause(req.$select),\n groupBy: [],\n where: undefined,\n };\n if (req.$groupBy) {\n body.groupBy = modernToLegacyGroupByClause(req.$groupBy);\n }\n if (req.$where) {\n body.where = modernToLegacyWhereClause(req.$where, objectType);\n }\n const result = await OntologiesV2.OntologyObjectSets.aggregate(addUserAgentAndRequestContextHeaders(clientCtx, objectType), await clientCtx.ontologyRid, {\n objectSet,\n groupBy: body.groupBy,\n aggregation: body.aggregation,\n });\n if (!req.$groupBy) {\n invariant(result.data.length === 1, \"no group by clause should mean only one data result\");\n return {\n ...aggregationToCountResult(result.data[0]),\n ...legacyToModernSingleAggregationResult(result.data[0]),\n };\n }\n const ret = result.data\n .map((entry) => {\n return {\n $group: entry.group,\n ...aggregationToCountResult(entry),\n ...legacyToModernSingleAggregationResult(entry),\n };\n }); // fixme\n return ret; // FIXME\n}\nfunction aggregationToCountResult(entry) {\n for (const aggregateResult of entry.metrics) {\n if (aggregateResult.name === \"count\") {\n return { $count: aggregateResult.value };\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,OAAOC,SAAS,MAAM,gBAAgB;AACtC,SAASC,qCAAqC,QAAQ,kEAAkE;AACxH,SAASC,+BAA+B,QAAQ,4DAA4D;AAC5G,SAASC,2BAA2B,QAAQ,wDAAwD;AACpG,SAASC,yBAAyB,QAAQ,sDAAsD;AAChG,SAASC,oCAAoC,QAAQ,iDAAiD;AACtG;AACA,OAAO,eAAeC,SAASA,CAACC,SAAS,EAAEC,UAAU,EAAEC,SAAS,GAAG;EAC/DC,IAAI,EAAE,MAAM;EACZF,UAAU,EAAEA,UAAU,CAAC,SAAS;AACpC,CAAC,EAAEG,GAAG,EAAE;EACJ,MAAMC,IAAI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CAAC;AAChB;AACA,SAASD,wBAAwBA,CAACG,KAAK,EAAE;EACrC,KAAK,MAAMG,eAAe,IAAIH,KAAK,CAACI,OAAO,EAAE;IACzC,IAAID,eAAe,CAACE,IAAI,KAAK,OAAO,EAAE;MAClC,OAAO;QAAEC,MAAM,EAAEH,eAAe,CAACI;MAAM,CAAC;IAC5C;EACJ;AACJ","ignoreList":[]}
|
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { FetchedObjectTypeDefinition } from "../../ontology/OntologyProvider.js";
|
|
3
|
-
import type { InterfaceDefRef, UnderlyingOsdkObject } from "./InternalSymbols.js";
|
|
4
|
-
import type { ObjectHolder } from "./ObjectHolder.js";
|
|
5
|
-
export interface InterfaceHolderOwnProps<Q extends FetchedObjectTypeDefinition> {
|
|
6
|
-
[UnderlyingOsdkObject]: Osdk<Q> & ObjectHolder<Q>;
|
|
7
|
-
[InterfaceDefRef]: InterfaceMetadata;
|
|
8
|
-
}
|
|
9
|
-
export interface InterfaceHolder<Q extends FetchedObjectTypeDefinition> extends InterfaceHolderOwnProps<Q> {
|
|
10
|
-
}
|
|
1
|
+
export {};
|
|
11
2
|
//# sourceMappingURL=InterfaceHolder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InterfaceHolder.d.ts","sourceRoot":"","sources":["../../../../src/object/convertWireToOsdkObjects/InterfaceHolder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InterfaceHolder.d.ts","sourceRoot":"","sources":["../../../../src/object/convertWireToOsdkObjects/InterfaceHolder.ts"],"names":[],"mappings":""}
|
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import type { ObjectOrInterfaceDefinition, OsdkBase } from "@osdk/api";
|
|
2
|
-
export declare const UnderlyingOsdkObject: unique symbol;
|
|
3
|
-
export declare const ObjectDefRef: unique symbol;
|
|
4
|
-
export declare const InterfaceDefRef: unique symbol;
|
|
5
|
-
/** A symbol for getting the raw data object off of the holder an osdk object proxy points to */
|
|
6
|
-
export declare const RawObject: unique symbol;
|
|
7
|
-
export declare const ClientRef: unique symbol;
|
|
8
|
-
export declare const CachedPropertiesRef: unique symbol;
|
|
9
2
|
export interface HolderBase<T extends ObjectOrInterfaceDefinition> {
|
|
10
3
|
[UnderlyingOsdkObject]: OsdkBase<any>;
|
|
11
4
|
[ObjectDefRef]?: T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalSymbols.d.ts","sourceRoot":"","sources":["../../../../src/object/convertWireToOsdkObjects/InternalSymbols.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,2BAA2B,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"InternalSymbols.d.ts","sourceRoot":"","sources":["../../../../src/object/convertWireToOsdkObjects/InternalSymbols.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,2BAA2B,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAiCvE,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,2BAA2B;IAC/D,CAAC,oBAAoB,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC;IACnB,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC;CACvB"}
|
|
@@ -13,11 +13,17 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
/** @internal */
|
|
16
17
|
export const UnderlyingOsdkObject = Symbol("Underlying Object");
|
|
18
|
+
/** @internal */
|
|
17
19
|
export const ObjectDefRef = Symbol("ObjectDefinition");
|
|
20
|
+
/** @internal */
|
|
18
21
|
export const InterfaceDefRef = Symbol("InterfaceDefinition");
|
|
19
22
|
/** A symbol for getting the raw data object off of the holder an osdk object proxy points to */
|
|
23
|
+
/** @internal */
|
|
20
24
|
export const RawObject = Symbol("RawObject");
|
|
25
|
+
/** @internal */
|
|
21
26
|
export const ClientRef = Symbol("ClientRef");
|
|
27
|
+
/** @internal */
|
|
22
28
|
export const CachedPropertiesRef = Symbol("CachedProperties");
|
|
23
29
|
//# sourceMappingURL=InternalSymbols.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalSymbols.js","names":["UnderlyingOsdkObject","Symbol","ObjectDefRef","InterfaceDefRef","RawObject","ClientRef","CachedPropertiesRef"],"sources":["InternalSymbols.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 */\nexport const UnderlyingOsdkObject = Symbol(process.env.MODE !== \"production\" ? \"Underlying Object\" : undefined);\nexport const ObjectDefRef = Symbol(process.env.MODE !== \"production\" ? \"ObjectDefinition\" : undefined);\nexport const InterfaceDefRef = Symbol(process.env.MODE !== \"production\" ? \"InterfaceDefinition\" : undefined);\n/** A symbol for getting the raw data object off of the holder an osdk object proxy points to */\nexport const RawObject = Symbol(process.env.MODE !== \"production\" ? \"RawObject\" : undefined);\nexport const ClientRef = Symbol(process.env.MODE !== \"production\" ? \"ClientRef\" : undefined);\nexport const CachedPropertiesRef = Symbol(process.env.MODE !== \"production\" ? \"CachedProperties\" : undefined);\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,oBAAoB,GAAGC,MAAM,CAAqC,mBAA+B,CAAC;AAC/G,OAAO,MAAMC,YAAY,GAAGD,MAAM,CAAqC,kBAA8B,CAAC;AACtG,OAAO,MAAME,eAAe,GAAGF,MAAM,CAAqC,qBAAiC,CAAC;AAC5G;AACA,OAAO,MAAMG,SAAS,GAAGH,MAAM,CAAqC,WAAuB,CAAC;AAC5F,OAAO,MAAMI,SAAS,GAAGJ,MAAM,CAAqC,WAAuB,CAAC;AAC5F,OAAO,MAAMK,mBAAmB,GAAGL,MAAM,CAAqC,kBAA8B,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"InternalSymbols.js","names":["UnderlyingOsdkObject","Symbol","ObjectDefRef","InterfaceDefRef","RawObject","ClientRef","CachedPropertiesRef"],"sources":["InternalSymbols.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 */\n/** @internal */\nexport const UnderlyingOsdkObject = Symbol(process.env.MODE !== \"production\" ? \"Underlying Object\" : undefined);\n/** @internal */\nexport const ObjectDefRef = Symbol(process.env.MODE !== \"production\" ? \"ObjectDefinition\" : undefined);\n/** @internal */\nexport const InterfaceDefRef = Symbol(process.env.MODE !== \"production\" ? \"InterfaceDefinition\" : undefined);\n/** A symbol for getting the raw data object off of the holder an osdk object proxy points to */\n/** @internal */\nexport const RawObject = Symbol(process.env.MODE !== \"production\" ? \"RawObject\" : undefined);\n/** @internal */\nexport const ClientRef = Symbol(process.env.MODE !== \"production\" ? \"ClientRef\" : undefined);\n/** @internal */\nexport const CachedPropertiesRef = Symbol(process.env.MODE !== \"production\" ? \"CachedProperties\" : undefined);\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,oBAAoB,GAAGC,MAAM,CAAqC,mBAA+B,CAAC;AAC/G;AACA,OAAO,MAAMC,YAAY,GAAGD,MAAM,CAAqC,kBAA8B,CAAC;AACtG;AACA,OAAO,MAAME,eAAe,GAAGF,MAAM,CAAqC,qBAAiC,CAAC;AAC5G;AACA;AACA,OAAO,MAAMG,SAAS,GAAGH,MAAM,CAAqC,WAAuB,CAAC;AAC5F;AACA,OAAO,MAAMI,SAAS,GAAGJ,MAAM,CAAqC,WAAuB,CAAC;AAC5F;AACA,OAAO,MAAMK,mBAAmB,GAAGL,MAAM,CAAqC,kBAA8B,CAAC","ignoreList":[]}
|
|
@@ -90,7 +90,13 @@ export function createOsdkObject(client, objectDef, rawObj) {
|
|
|
90
90
|
if (instance != null) {
|
|
91
91
|
return instance;
|
|
92
92
|
}
|
|
93
|
-
const geotimeProp = new GeotimeSeriesPropertyImpl(client, objectDef.apiName, target[RawObject][objectDef.primaryKeyApiName], p
|
|
93
|
+
const geotimeProp = new GeotimeSeriesPropertyImpl(client, objectDef.apiName, target[RawObject][objectDef.primaryKeyApiName], p, rawValue.type === "geotimeSeriesValue" ? {
|
|
94
|
+
time: rawValue.timestamp,
|
|
95
|
+
value: {
|
|
96
|
+
type: "Point",
|
|
97
|
+
coordinates: rawValue.position
|
|
98
|
+
}
|
|
99
|
+
} : undefined);
|
|
94
100
|
target[CachedPropertiesRef].set(p, geotimeProp);
|
|
95
101
|
return geotimeProp;
|
|
96
102
|
}
|