@osdk/client 2.2.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/build/browser/Client.js +1 -1
  3. package/build/browser/Client.js.map +1 -1
  4. package/build/browser/createMediaReferenceProperty.js +7 -1
  5. package/build/browser/createMediaReferenceProperty.js.map +1 -1
  6. package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js +2 -1
  7. package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
  8. package/build/browser/object/media.test.js +20 -1
  9. package/build/browser/object/media.test.js.map +1 -1
  10. package/build/browser/util/UserAgent.js +1 -1
  11. package/build/cjs/{chunk-5JZGGCIW.cjs → chunk-LPYAXRWJ.cjs} +14 -14
  12. package/build/cjs/{chunk-5JZGGCIW.cjs.map → chunk-LPYAXRWJ.cjs.map} +1 -1
  13. package/build/cjs/{chunk-HDAQ6JIR.cjs → chunk-UCW7RLKM.cjs} +2 -2
  14. package/build/cjs/{chunk-HDAQ6JIR.cjs.map → chunk-UCW7RLKM.cjs.map} +1 -1
  15. package/build/cjs/index.cjs +56 -49
  16. package/build/cjs/index.cjs.map +1 -1
  17. package/build/cjs/public/internal.cjs +8 -8
  18. package/build/cjs/public/unstable-do-not-use.cjs +8 -8
  19. package/build/esm/Client.js +1 -1
  20. package/build/esm/Client.js.map +1 -1
  21. package/build/esm/createMediaReferenceProperty.js +7 -1
  22. package/build/esm/createMediaReferenceProperty.js.map +1 -1
  23. package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js +2 -1
  24. package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
  25. package/build/esm/object/media.test.js +20 -1
  26. package/build/esm/object/media.test.js.map +1 -1
  27. package/build/esm/util/UserAgent.js +1 -1
  28. package/build/types/Client.d.ts +1 -1
  29. package/build/types/createMediaReferenceProperty.d.ts +4 -1
  30. package/build/types/createMediaReferenceProperty.d.ts.map +1 -1
  31. package/package.json +7 -7
@@ -1,19 +1,19 @@
1
1
  'use strict';
2
2
 
3
- var chunk5JZGGCIW_cjs = require('../chunk-5JZGGCIW.cjs');
4
- var chunkHDAQ6JIR_cjs = require('../chunk-HDAQ6JIR.cjs');
3
+ var chunkLPYAXRWJ_cjs = require('../chunk-LPYAXRWJ.cjs');
4
+ var chunkUCW7RLKM_cjs = require('../chunk-UCW7RLKM.cjs');
5
5
 
6
6
  // src/public-utils/createAndFetchTempObjectSetRid.ts
7
7
  async function createAndFetchTempObjectSetRid(client, objectSet) {
8
- const response = await chunkHDAQ6JIR_cjs.OntologyObjectSet_exports.createTemporary(client, await client[chunkHDAQ6JIR_cjs.additionalContext].ontologyRid, {
9
- objectSet: chunk5JZGGCIW_cjs.getWireObjectSet(objectSet)
8
+ const response = await chunkUCW7RLKM_cjs.OntologyObjectSet_exports.createTemporary(client, await client[chunkUCW7RLKM_cjs.additionalContext].ontologyRid, {
9
+ objectSet: chunkLPYAXRWJ_cjs.getWireObjectSet(objectSet)
10
10
  });
11
11
  return response.objectSetRid;
12
12
  }
13
13
 
14
14
  // src/public-utils/hydrateObjectSetFromRid.ts
15
15
  function hydrateObjectSetFromRid(client, definition, rid) {
16
- return chunk5JZGGCIW_cjs.createObjectSet(definition, client[chunkHDAQ6JIR_cjs.additionalContext], {
16
+ return chunkLPYAXRWJ_cjs.createObjectSet(definition, client[chunkUCW7RLKM_cjs.additionalContext], {
17
17
  type: "intersect",
18
18
  objectSets: [{
19
19
  type: "base",
@@ -51,7 +51,7 @@ var levelStyles = {
51
51
  color: "orange"
52
52
  })
53
53
  };
54
- var BrowserLogger = class _BrowserLogger extends chunk5JZGGCIW_cjs.BaseLogger {
54
+ var BrowserLogger = class _BrowserLogger extends chunkLPYAXRWJ_cjs.BaseLogger {
55
55
  constructor(bindings = {}, options = {}) {
56
56
  super(bindings, {
57
57
  ...options,
@@ -77,11 +77,11 @@ var BrowserLogger = class _BrowserLogger extends chunk5JZGGCIW_cjs.BaseLogger {
77
77
 
78
78
  Object.defineProperty(exports, "MinimalLogger", {
79
79
  enumerable: true,
80
- get: function () { return chunk5JZGGCIW_cjs.MinimalLogger; }
80
+ get: function () { return chunkLPYAXRWJ_cjs.MinimalLogger; }
81
81
  });
82
82
  Object.defineProperty(exports, "hydrateAttachmentFromRid", {
83
83
  enumerable: true,
84
- get: function () { return chunk5JZGGCIW_cjs.hydrateAttachmentFromRid; }
84
+ get: function () { return chunkLPYAXRWJ_cjs.hydrateAttachmentFromRid; }
85
85
  });
86
86
  exports.BrowserLogger = BrowserLogger;
87
87
  exports.createAndFetchTempObjectSetRid = createAndFetchTempObjectSetRid;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkT4NIFYZS_cjs = require('../chunk-T4NIFYZS.cjs');
4
- var chunkHDAQ6JIR_cjs = require('../chunk-HDAQ6JIR.cjs');
4
+ var chunkUCW7RLKM_cjs = require('../chunk-UCW7RLKM.cjs');
5
5
  var rxjs = require('rxjs');
6
6
  var invariant2 = require('tiny-invariant');
7
7
  var mnemonist = require('mnemonist');
@@ -191,7 +191,7 @@ var OptimisticJob = class {
191
191
  return this;
192
192
  },
193
193
  createObject(type, pk, properties) {
194
- const create = store.client[chunkHDAQ6JIR_cjs.additionalContext].objectFactory2(store.client[chunkHDAQ6JIR_cjs.additionalContext], [{
194
+ const create = store.client[chunkUCW7RLKM_cjs.additionalContext].objectFactory2(store.client[chunkUCW7RLKM_cjs.additionalContext], [{
195
195
  $primaryKey: pk,
196
196
  $apiName: type.apiName,
197
197
  $objectType: type.apiName,
@@ -596,7 +596,7 @@ var BulkObjectLoader = class {
596
596
  #maxEntries;
597
597
  constructor(client, maxWait = 25, maxEntries = 100) {
598
598
  this.#client = client;
599
- this.#logger = client[chunkHDAQ6JIR_cjs.additionalContext].logger;
599
+ this.#logger = client[chunkUCW7RLKM_cjs.additionalContext].logger;
600
600
  this.#maxWait = maxWait;
601
601
  this.#maxEntries = maxEntries;
602
602
  }
@@ -666,7 +666,7 @@ var Query = class {
666
666
  this.cacheKey = cacheKey;
667
667
  this.store = store;
668
668
  this.#subject = observable;
669
- this.logger = logger ?? (process.env.NODE_ENV === "production" ? store.client[chunkHDAQ6JIR_cjs.additionalContext].logger : store.client[chunkHDAQ6JIR_cjs.additionalContext].logger?.child({}, {
669
+ this.logger = logger ?? (process.env.NODE_ENV === "production" ? store.client[chunkUCW7RLKM_cjs.additionalContext].logger : store.client[chunkUCW7RLKM_cjs.additionalContext].logger?.child({}, {
670
670
  msgPrefix: process.env.NODE_ENV !== "production" ? `Query<${cacheKey.type}, ${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>` : "Query"
671
671
  }));
672
672
  }
@@ -773,7 +773,7 @@ var ObjectQuery = class extends Query {
773
773
  #apiName;
774
774
  #pk;
775
775
  constructor(store, subject, type, pk, cacheKey, opts) {
776
- super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkHDAQ6JIR_cjs.additionalContext].logger?.child({}, {
776
+ super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkUCW7RLKM_cjs.additionalContext].logger?.child({}, {
777
777
  msgPrefix: `ObjectQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
778
778
  }) : void 0);
779
779
  this.#apiName = type;
@@ -934,7 +934,7 @@ var ListQuery = class extends BaseListQuery {
934
934
  #objectSet;
935
935
  #sortFns;
936
936
  constructor(store, subject, apiType, apiName, whereClause, orderBy, cacheKey, opts) {
937
- super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkHDAQ6JIR_cjs.additionalContext].logger?.child({}, {
937
+ super(store, subject, opts, cacheKey, process.env.NODE_ENV !== "production" ? store.client[chunkUCW7RLKM_cjs.additionalContext].logger?.child({}, {
938
938
  msgPrefix: `ListQuery<${cacheKey.otherKeys.map((x) => JSON.stringify(x)).join(", ")}>`
939
939
  }) : void 0);
940
940
  this.#type = apiType;
@@ -1563,7 +1563,7 @@ var Store = class {
1563
1563
  #finalizationRegistry;
1564
1564
  constructor(client) {
1565
1565
  this.client = client;
1566
- this.logger = client[chunkHDAQ6JIR_cjs.additionalContext].logger?.child({}, {
1566
+ this.logger = client[chunkUCW7RLKM_cjs.additionalContext].logger?.child({}, {
1567
1567
  msgPrefix: "Store"
1568
1568
  });
1569
1569
  this.#topLayer = this.#truthLayer;
@@ -1893,7 +1893,7 @@ function getOsdkConfig(ontologyRid) {
1893
1893
 
1894
1894
  Object.defineProperty(exports, "augment", {
1895
1895
  enumerable: true,
1896
- get: function () { return chunkHDAQ6JIR_cjs.augment; }
1896
+ get: function () { return chunkUCW7RLKM_cjs.augment; }
1897
1897
  });
1898
1898
  exports.createObservableClient = createObservableClient;
1899
1899
  exports.getMetaTagContent = getMetaTagContent;
@@ -21,7 +21,7 @@
21
21
  export const additionalContext = Symbol("additionalContext");
22
22
 
23
23
  // BEGIN: THIS IS GENERATED CODE. DO NOT EDIT.
24
- const MaxOsdkVersion = "2.2.0";
24
+ const MaxOsdkVersion = "2.2.1";
25
25
  // END: THIS IS GENERATED CODE. DO NOT EDIT.
26
26
 
27
27
  const ErrorMessage = Symbol("ErrorMessage");
@@ -1 +1 @@
1
- {"version":3,"file":"Client.js","names":["additionalContext","Symbol","MaxOsdkVersion","ErrorMessage"],"sources":["Client.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n ActionMetadata,\n CompileTimeMetadata,\n InterfaceDefinition,\n InterfaceMetadata,\n ObjectMetadata,\n ObjectSet,\n ObjectTypeDefinition,\n QueryDefinition,\n QueryMetadata,\n VersionBound,\n} from \"@osdk/api\";\nimport type {\n Experiment,\n ExperimentFns,\n MinimalObjectSet,\n} from \"@osdk/api/unstable\";\nimport type { SharedClient } from \"@osdk/shared.client2\";\nimport type { ActionSignatureFromDef } from \"./actions/applyAction.js\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport type { QuerySignatureFromDef } from \"./queries/types.js\";\nimport type { SatisfiesSemver } from \"./SatisfiesSemver.js\";\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\ntype OldSharedClient = import(\"@osdk/shared.client\").SharedClient;\n\nexport type CheckVersionBound<Q> = Q extends VersionBound<infer V> ? (\n SatisfiesSemver<V, MaxOsdkVersion> extends true ? Q\n : Q & {\n [ErrorMessage]:\n `Your SDK requires a semver compatible version with ${V}. You have ${MaxOsdkVersion}. Update your package.json`;\n }\n )\n : Q;\n\nexport interface Client extends SharedClient, OldSharedClient {\n <Q extends ObjectTypeDefinition>(\n o: Q,\n ): unknown extends CompileTimeMetadata<Q>[\"objectSet\"] ? ObjectSet<Q>\n : CompileTimeMetadata<Q>[\"objectSet\"];\n\n <Q extends (InterfaceDefinition)>(\n o: Q,\n ): unknown extends CompileTimeMetadata<Q>[\"objectSet\"] ? MinimalObjectSet<Q>\n : CompileTimeMetadata<Q>[\"objectSet\"];\n\n <Q extends ActionDefinition<any>>(\n o: Q,\n ): ActionSignatureFromDef<Q>;\n\n <Q extends QueryDefinition<any>>(\n o: Q,\n ): QuerySignatureFromDef<Q>;\n\n <Q extends Experiment<\"2.0.8\"> | Experiment<\"2.1.0\"> | Experiment<\"2.2.0\">>(\n experiment: Q,\n ): ExperimentFns<Q>;\n\n fetchMetadata<\n Q extends (\n | ObjectTypeDefinition\n | InterfaceDefinition\n | ActionDefinition<any>\n | QueryDefinition<any>\n ),\n >(o: Q): Promise<\n Q extends ObjectTypeDefinition ? ObjectMetadata\n : Q extends InterfaceDefinition ? InterfaceMetadata\n : Q extends ActionDefinition<any> ? ActionMetadata\n : Q extends QueryDefinition<any> ? QueryMetadata\n : never\n >;\n\n /** @internal */\n [additionalContext]: MinimalClient;\n}\n\n// DO NOT EXPORT FROM PACKAGE\n/** @internal */\nexport const additionalContext: unique symbol = Symbol(\"additionalContext\");\n\n// BEGIN: THIS IS GENERATED CODE. DO NOT EDIT.\nconst MaxOsdkVersion = \"2.2.0\";\n// END: THIS IS GENERATED CODE. DO NOT EDIT.\nexport type MaxOsdkVersion = typeof MaxOsdkVersion;\nconst ErrorMessage: unique symbol = Symbol(\"ErrorMessage\");\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA0BA;;AAsDA;AACA;AACA,OAAO,MAAMA,iBAAgC,GAAGC,MAAM,CAAC,mBAAmB,CAAC;;AAE3E;AACA,MAAMC,cAAc,GAAG,OAAO;AAC9B;;AAEA,MAAMC,YAA2B,GAAGF,MAAM,CAAC,cAAc,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Client.js","names":["additionalContext","Symbol","MaxOsdkVersion","ErrorMessage"],"sources":["Client.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n ActionMetadata,\n CompileTimeMetadata,\n InterfaceDefinition,\n InterfaceMetadata,\n ObjectMetadata,\n ObjectSet,\n ObjectTypeDefinition,\n QueryDefinition,\n QueryMetadata,\n VersionBound,\n} from \"@osdk/api\";\nimport type {\n Experiment,\n ExperimentFns,\n MinimalObjectSet,\n} from \"@osdk/api/unstable\";\nimport type { SharedClient } from \"@osdk/shared.client2\";\nimport type { ActionSignatureFromDef } from \"./actions/applyAction.js\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport type { QuerySignatureFromDef } from \"./queries/types.js\";\nimport type { SatisfiesSemver } from \"./SatisfiesSemver.js\";\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\ntype OldSharedClient = import(\"@osdk/shared.client\").SharedClient;\n\nexport type CheckVersionBound<Q> = Q extends VersionBound<infer V> ? (\n SatisfiesSemver<V, MaxOsdkVersion> extends true ? Q\n : Q & {\n [ErrorMessage]:\n `Your SDK requires a semver compatible version with ${V}. You have ${MaxOsdkVersion}. Update your package.json`;\n }\n )\n : Q;\n\nexport interface Client extends SharedClient, OldSharedClient {\n <Q extends ObjectTypeDefinition>(\n o: Q,\n ): unknown extends CompileTimeMetadata<Q>[\"objectSet\"] ? ObjectSet<Q>\n : CompileTimeMetadata<Q>[\"objectSet\"];\n\n <Q extends (InterfaceDefinition)>(\n o: Q,\n ): unknown extends CompileTimeMetadata<Q>[\"objectSet\"] ? MinimalObjectSet<Q>\n : CompileTimeMetadata<Q>[\"objectSet\"];\n\n <Q extends ActionDefinition<any>>(\n o: Q,\n ): ActionSignatureFromDef<Q>;\n\n <Q extends QueryDefinition<any>>(\n o: Q,\n ): QuerySignatureFromDef<Q>;\n\n <Q extends Experiment<\"2.0.8\"> | Experiment<\"2.1.0\"> | Experiment<\"2.2.0\">>(\n experiment: Q,\n ): ExperimentFns<Q>;\n\n fetchMetadata<\n Q extends (\n | ObjectTypeDefinition\n | InterfaceDefinition\n | ActionDefinition<any>\n | QueryDefinition<any>\n ),\n >(o: Q): Promise<\n Q extends ObjectTypeDefinition ? ObjectMetadata\n : Q extends InterfaceDefinition ? InterfaceMetadata\n : Q extends ActionDefinition<any> ? ActionMetadata\n : Q extends QueryDefinition<any> ? QueryMetadata\n : never\n >;\n\n /** @internal */\n [additionalContext]: MinimalClient;\n}\n\n// DO NOT EXPORT FROM PACKAGE\n/** @internal */\nexport const additionalContext: unique symbol = Symbol(\"additionalContext\");\n\n// BEGIN: THIS IS GENERATED CODE. DO NOT EDIT.\nconst MaxOsdkVersion = \"2.2.1\";\n// END: THIS IS GENERATED CODE. DO NOT EDIT.\nexport type MaxOsdkVersion = typeof MaxOsdkVersion;\nconst ErrorMessage: unique symbol = Symbol(\"ErrorMessage\");\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA0BA;;AAsDA;AACA;AACA,OAAO,MAAMA,iBAAgC,GAAGC,MAAM,CAAC,mBAAmB,CAAC;;AAE3E;AACA,MAAMC,cAAc,GAAG,OAAO;AAC9B;;AAEA,MAAMC,YAA2B,GAAGF,MAAM,CAAC,cAAc,CAAC","ignoreList":[]}
@@ -16,6 +16,7 @@
16
16
 
17
17
  import * as OntologiesV2 from "@osdk/foundry.ontologies";
18
18
  export class MediaReferencePropertyImpl {
19
+ #mediaReference;
19
20
  #triplet;
20
21
  #client;
21
22
  constructor(args) {
@@ -23,10 +24,12 @@ export class MediaReferencePropertyImpl {
23
24
  client,
24
25
  objectApiName,
25
26
  primaryKey,
26
- propertyName
27
+ propertyName,
28
+ mediaReference
27
29
  } = args;
28
30
  this.#client = client;
29
31
  this.#triplet = [objectApiName, primaryKey, propertyName];
32
+ this.#mediaReference = mediaReference;
30
33
  }
31
34
  async fetchContents() {
32
35
  return OntologiesV2.MediaReferenceProperties.getMediaContent(this.#client, await this.#client.ontologyRid, ...this.#triplet, {
@@ -43,5 +46,8 @@ export class MediaReferencePropertyImpl {
43
46
  mediaType: r.mediaType
44
47
  };
45
48
  }
49
+ getMediaReference() {
50
+ return this.#mediaReference;
51
+ }
46
52
  }
47
53
  //# sourceMappingURL=createMediaReferenceProperty.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createMediaReferenceProperty.js","names":["OntologiesV2","MediaReferencePropertyImpl","triplet","client","constructor","args","objectApiName","primaryKey","propertyName","fetchContents","MediaReferenceProperties","getMediaContent","ontologyRid","preview","fetchMetadata","r","getMediaMetadata","path","sizeBytes","Number","mediaType"],"sources":["createMediaReferenceProperty.ts"],"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\nimport type { Media, MediaMetadata } from \"@osdk/api\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\n\nexport class MediaReferencePropertyImpl implements Media {\n #triplet: [string, any, string];\n #client: MinimalClient;\n\n constructor(args: {\n client: MinimalClient;\n objectApiName: string;\n primaryKey: any;\n propertyName: string;\n }) {\n const { client, objectApiName, primaryKey, propertyName } = args;\n this.#client = client;\n this.#triplet = [objectApiName, primaryKey, propertyName];\n }\n\n public async fetchContents(): Promise<Response> {\n return OntologiesV2.MediaReferenceProperties.getMediaContent(\n this.#client,\n await this.#client.ontologyRid,\n ...this.#triplet,\n {\n preview: true, // TODO: Can turn this back off when backend is no longer in beta.\n },\n );\n }\n\n public async fetchMetadata(): Promise<MediaMetadata> {\n const r = await OntologiesV2.MediaReferenceProperties.getMediaMetadata(\n this.#client,\n await this.#client.ontologyRid,\n ...this.#triplet,\n {\n preview: true, // TODO: Can turn this back off when backend is no longer in beta.\n },\n );\n return {\n path: r.path as string,\n sizeBytes: Number(r.sizeBytes),\n mediaType: r.mediaType,\n };\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAO,KAAKA,YAAY,MAAM,0BAA0B;AAGxD,OAAO,MAAMC,0BAA0B,CAAkB;EACvD,CAACC,OAAO;EACR,CAACC,MAAM;EAEPC,WAAWA,CAACC,IAKX,EAAE;IACD,MAAM;MAAEF,MAAM;MAAEG,aAAa;MAAEC,UAAU;MAAEC;IAAa,CAAC,GAAGH,IAAI;IAChE,IAAI,CAAC,CAACF,MAAM,GAAGA,MAAM;IACrB,IAAI,CAAC,CAACD,OAAO,GAAG,CAACI,aAAa,EAAEC,UAAU,EAAEC,YAAY,CAAC;EAC3D;EAEA,MAAaC,aAAaA,CAAA,EAAsB;IAC9C,OAAOT,YAAY,CAACU,wBAAwB,CAACC,eAAe,CAC1D,IAAI,CAAC,CAACR,MAAM,EACZ,MAAM,IAAI,CAAC,CAACA,MAAM,CAACS,WAAW,EAC9B,GAAG,IAAI,CAAC,CAACV,OAAO,EAChB;MACEW,OAAO,EAAE,IAAI,CAAE;IACjB,CACF,CAAC;EACH;EAEA,MAAaC,aAAaA,CAAA,EAA2B;IACnD,MAAMC,CAAC,GAAG,MAAMf,YAAY,CAACU,wBAAwB,CAACM,gBAAgB,CACpE,IAAI,CAAC,CAACb,MAAM,EACZ,MAAM,IAAI,CAAC,CAACA,MAAM,CAACS,WAAW,EAC9B,GAAG,IAAI,CAAC,CAACV,OAAO,EAChB;MACEW,OAAO,EAAE,IAAI,CAAE;IACjB,CACF,CAAC;IACD,OAAO;MACLI,IAAI,EAAEF,CAAC,CAACE,IAAc;MACtBC,SAAS,EAAEC,MAAM,CAACJ,CAAC,CAACG,SAAS,CAAC;MAC9BE,SAAS,EAAEL,CAAC,CAACK;IACf,CAAC;EACH;AACF","ignoreList":[]}
1
+ {"version":3,"file":"createMediaReferenceProperty.js","names":["OntologiesV2","MediaReferencePropertyImpl","mediaReference","triplet","client","constructor","args","objectApiName","primaryKey","propertyName","fetchContents","MediaReferenceProperties","getMediaContent","ontologyRid","preview","fetchMetadata","r","getMediaMetadata","path","sizeBytes","Number","mediaType","getMediaReference"],"sources":["createMediaReferenceProperty.ts"],"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\nimport type { Media, MediaMetadata, MediaReference } from \"@osdk/api\";\nimport type { MediaReference as CoreMediaReference } from \"@osdk/foundry.core\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\n\nexport class MediaReferencePropertyImpl implements Media {\n #mediaReference: MediaReference;\n #triplet: [string, any, string];\n #client: MinimalClient;\n\n constructor(args: {\n client: MinimalClient;\n objectApiName: string;\n primaryKey: any;\n propertyName: string;\n mediaReference: CoreMediaReference;\n }) {\n const {\n client,\n objectApiName,\n primaryKey,\n propertyName,\n mediaReference,\n } = args;\n this.#client = client;\n this.#triplet = [objectApiName, primaryKey, propertyName];\n this.#mediaReference = mediaReference;\n }\n\n public async fetchContents(): Promise<Response> {\n return OntologiesV2.MediaReferenceProperties.getMediaContent(\n this.#client,\n await this.#client.ontologyRid,\n ...this.#triplet,\n {\n preview: true, // TODO: Can turn this back off when backend is no longer in beta.\n },\n );\n }\n\n public async fetchMetadata(): Promise<MediaMetadata> {\n const r = await OntologiesV2.MediaReferenceProperties.getMediaMetadata(\n this.#client,\n await this.#client.ontologyRid,\n ...this.#triplet,\n {\n preview: true, // TODO: Can turn this back off when backend is no longer in beta.\n },\n );\n return {\n path: r.path as string,\n sizeBytes: Number(r.sizeBytes),\n mediaType: r.mediaType,\n };\n }\n\n public getMediaReference(): MediaReference {\n return this.#mediaReference;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAO,KAAKA,YAAY,MAAM,0BAA0B;AAGxD,OAAO,MAAMC,0BAA0B,CAAkB;EACvD,CAACC,cAAc;EACf,CAACC,OAAO;EACR,CAACC,MAAM;EAEPC,WAAWA,CAACC,IAMX,EAAE;IACD,MAAM;MACJF,MAAM;MACNG,aAAa;MACbC,UAAU;MACVC,YAAY;MACZP;IACF,CAAC,GAAGI,IAAI;IACR,IAAI,CAAC,CAACF,MAAM,GAAGA,MAAM;IACrB,IAAI,CAAC,CAACD,OAAO,GAAG,CAACI,aAAa,EAAEC,UAAU,EAAEC,YAAY,CAAC;IACzD,IAAI,CAAC,CAACP,cAAc,GAAGA,cAAc;EACvC;EAEA,MAAaQ,aAAaA,CAAA,EAAsB;IAC9C,OAAOV,YAAY,CAACW,wBAAwB,CAACC,eAAe,CAC1D,IAAI,CAAC,CAACR,MAAM,EACZ,MAAM,IAAI,CAAC,CAACA,MAAM,CAACS,WAAW,EAC9B,GAAG,IAAI,CAAC,CAACV,OAAO,EAChB;MACEW,OAAO,EAAE,IAAI,CAAE;IACjB,CACF,CAAC;EACH;EAEA,MAAaC,aAAaA,CAAA,EAA2B;IACnD,MAAMC,CAAC,GAAG,MAAMhB,YAAY,CAACW,wBAAwB,CAACM,gBAAgB,CACpE,IAAI,CAAC,CAACb,MAAM,EACZ,MAAM,IAAI,CAAC,CAACA,MAAM,CAACS,WAAW,EAC9B,GAAG,IAAI,CAAC,CAACV,OAAO,EAChB;MACEW,OAAO,EAAE,IAAI,CAAE;IACjB,CACF,CAAC;IACD,OAAO;MACLI,IAAI,EAAEF,CAAC,CAACE,IAAc;MACtBC,SAAS,EAAEC,MAAM,CAACJ,CAAC,CAACG,SAAS,CAAC;MAC9BE,SAAS,EAAEL,CAAC,CAACK;IACf,CAAC;EACH;EAEOC,iBAAiBA,CAAA,EAAmB;IACzC,OAAO,IAAI,CAAC,CAACpB,cAAc;EAC7B;AACF","ignoreList":[]}
@@ -155,7 +155,8 @@ function createSpecialProperty(client, objectDef, rawObject, p) {
155
155
  client,
156
156
  objectApiName: objectDef.apiName,
157
157
  primaryKey: rawObject[objectDef.primaryKeyApiName],
158
- propertyName: p
158
+ propertyName: p,
159
+ mediaReference: rawValue
159
160
  });
160
161
  }
161
162
  }
@@ -1 +1 @@
1
- {"version":3,"file":"createOsdkObject.js","names":["invariant","GeotimeSeriesPropertyImpl","MediaReferencePropertyImpl","TimeSeriesPropertyImpl","hydrateAttachmentFromRidInternal","createObjectSpecifierFromPrimaryKey","get$as","get$link","ClientRef","ObjectDefRef","UnderlyingOsdkObject","specialPropertyTypes","Set","basePropDefs","get","value","update","rawObj","def","createOsdkObject","primaryKeyApiName","Error","apiName","titleProperty","$title","newObject","$primaryKey","enumerable","client","objectDef","simpleOsdkProperties","derivedPropertyTypeByName","Object","defineProperties","propKey","keys","properties","type","has","createSpecialProperty","modifyRdpProperties","freeze","rawValue","definition","operation","num","Number","isSafeInteger","process","env","NODE_ENV","selectedOrCollectedPropertyType","Array","isArray","map","a","rid","rawObject","p","propDef","time","timestamp","coordinates","position","undefined","objectApiName","primaryKey","propertyName"],"sources":["createOsdkObject.ts"],"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\nimport type { Attachment, ReferenceValue } from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\nimport { GeotimeSeriesPropertyImpl } from \"../../createGeotimeSeriesProperty.js\";\nimport { MediaReferencePropertyImpl } from \"../../createMediaReferenceProperty.js\";\nimport { TimeSeriesPropertyImpl } from \"../../createTimeseriesProperty.js\";\nimport type { DerivedPropertyRuntimeMetadata } from \"../../derivedProperties/derivedPropertyRuntimeMetadata.js\";\nimport type { MinimalClient } from \"../../MinimalClientContext.js\";\nimport type { FetchedObjectTypeDefinition } from \"../../ontology/OntologyProvider.js\";\nimport { hydrateAttachmentFromRidInternal } from \"../../public-utils/hydrateAttachmentFromRid.js\";\nimport { createObjectSpecifierFromPrimaryKey } from \"../../util/objectSpecifierUtils.js\";\nimport type { SimpleOsdkProperties } from \"../SimpleOsdkProperties.js\";\nimport { get$as } from \"./getDollarAs.js\";\nimport { get$link } from \"./getDollarLink.js\";\nimport {\n ClientRef,\n ObjectDefRef,\n UnderlyingOsdkObject,\n} from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\nconst specialPropertyTypes = new Set(\n [\n \"attachment\",\n \"geotimeSeriesReference\",\n \"mediaReference\",\n \"numericTimeseries\",\n \"stringTimeseries\",\n \"sensorTimeseries\",\n ],\n);\n\n// kept separate so we are not redefining these functions\n// every time an object is created.\nconst basePropDefs = {\n \"$as\": {\n get: function(this: ObjectHolder) {\n return get$as(this[ObjectDefRef]);\n },\n },\n \"$link\": {\n get: function(this: ObjectHolder) {\n return get$link(this);\n },\n },\n \"$clone\": {\n value: function(\n this: ObjectHolder,\n update: Record<string, any> | undefined,\n ) {\n // I think `rawObj` is the same thing as `this` and can be removed?\n const rawObj = this[UnderlyingOsdkObject] as SimpleOsdkProperties;\n const def = this[ObjectDefRef];\n\n if (update == null) {\n return createOsdkObject(this[ClientRef], def, { ...rawObj });\n }\n\n if (\n def.primaryKeyApiName in update\n && rawObj[def.primaryKeyApiName] !== update[def.primaryKeyApiName]\n ) {\n throw new Error(\n `Cannot update ${def.apiName} object with differing primary key values `,\n );\n }\n\n if (def.titleProperty in update && !(\"$title\" in update)) {\n update.$title = update[def.titleProperty];\n }\n\n const newObject = { ...this[UnderlyingOsdkObject], ...update };\n return createOsdkObject(this[ClientRef], this[ObjectDefRef], newObject);\n },\n },\n \"$objectSpecifier\": {\n get: function(this: ObjectHolder) {\n const rawObj = this[UnderlyingOsdkObject];\n return createObjectSpecifierFromPrimaryKey(\n this[ObjectDefRef],\n rawObj.$primaryKey,\n );\n },\n enumerable: true,\n },\n};\n\n/**\n * @internal\n * @param client\n * @param objectDef\n * @param simpleOsdkProperties\n */\nexport function createOsdkObject(\n client: MinimalClient,\n objectDef: FetchedObjectTypeDefinition,\n simpleOsdkProperties: SimpleOsdkProperties,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata = {},\n): ObjectHolder {\n // updates the object's \"hidden class/map\".\n const rawObj = simpleOsdkProperties as ObjectHolder;\n Object.defineProperties(\n rawObj,\n {\n [UnderlyingOsdkObject]: {\n enumerable: false,\n value: simpleOsdkProperties,\n },\n [ObjectDefRef]: { value: objectDef, enumerable: false },\n [ClientRef]: { value: client, enumerable: false },\n ...basePropDefs,\n } satisfies Record<keyof ObjectHolder, PropertyDescriptor>,\n );\n\n // Assign the special values\n for (const propKey of Object.keys(rawObj)) {\n if (\n propKey in objectDef.properties\n && typeof (objectDef.properties[propKey].type) === \"string\"\n && specialPropertyTypes.has(objectDef.properties[propKey].type)\n ) {\n rawObj[propKey] = createSpecialProperty(\n client,\n objectDef,\n rawObj,\n propKey,\n );\n } else if (propKey in derivedPropertyTypeByName) {\n rawObj[propKey] = modifyRdpProperties(\n client,\n derivedPropertyTypeByName,\n rawObj[propKey],\n propKey,\n );\n }\n }\n\n return Object.freeze(rawObj);\n}\n\nfunction modifyRdpProperties(\n client: MinimalClient,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata,\n rawValue: any,\n propKey: string,\n): any {\n if (\n derivedPropertyTypeByName[propKey].definition.type === \"selection\"\n && derivedPropertyTypeByName[propKey].definition.operation.type\n === \"count\"\n ) {\n const num = Number(rawValue);\n invariant(\n Number.isSafeInteger(num),\n \"Count aggregation for derived property \" + propKey\n + \" returned a value larger than safe integer.\",\n );\n return num;\n } // Selected or collected properties need to be deserialized specially when constructed with RDP\n else if (\n derivedPropertyTypeByName[propKey].selectedOrCollectedPropertyType\n != null\n && typeof (derivedPropertyTypeByName[propKey]\n .selectedOrCollectedPropertyType.type)\n === \"string\"\n && specialPropertyTypes.has(\n derivedPropertyTypeByName[propKey].selectedOrCollectedPropertyType\n .type,\n )\n ) {\n switch (\n derivedPropertyTypeByName[propKey].selectedOrCollectedPropertyType\n ?.type\n ) {\n case \"attachment\":\n if (Array.isArray(rawValue)) {\n return rawValue.map(a =>\n hydrateAttachmentFromRidInternal(client, a.rid)\n );\n } else {\n return hydrateAttachmentFromRidInternal(\n client,\n (rawValue as Attachment).rid,\n );\n }\n break;\n default:\n invariant(\n false,\n \"Derived property aggregations for Timeseries and Media are not supported\",\n );\n }\n }\n return rawValue;\n}\n\nfunction createSpecialProperty(\n client: MinimalClient,\n objectDef: FetchedObjectTypeDefinition,\n rawObject: ObjectHolder,\n p: keyof typeof rawObject & string | symbol,\n) {\n const rawValue = rawObject[p as any];\n const propDef = objectDef.properties[p as any];\n if (process.env.NODE_ENV !== \"production\") {\n invariant(\n propDef != null && typeof propDef.type === \"string\"\n && specialPropertyTypes.has(propDef.type),\n );\n }\n if (propDef.type === \"attachment\") {\n if (Array.isArray(rawValue)) {\n return rawValue.map(a => hydrateAttachmentFromRidInternal(client, a.rid));\n }\n return hydrateAttachmentFromRidInternal(\n client,\n (rawValue as Attachment).rid,\n );\n }\n\n if (\n propDef.type === \"numericTimeseries\"\n || propDef.type === \"stringTimeseries\"\n || propDef.type === \"sensorTimeseries\"\n ) {\n return new TimeSeriesPropertyImpl<\n (typeof propDef)[\"type\"] extends \"numericTimeseries\" ? number\n : (typeof propDef)[\"type\"] extends \"stringTimeseries\" ? string\n : number | string\n >(\n client,\n objectDef.apiName,\n rawObject[objectDef.primaryKeyApiName as string],\n p as string,\n );\n }\n\n if (propDef.type === \"geotimeSeriesReference\") {\n return new GeotimeSeriesPropertyImpl<GeoJSON.Point>(\n client,\n objectDef.apiName,\n rawObject[objectDef.primaryKeyApiName as string],\n p as string,\n (rawValue as ReferenceValue).type === \"geotimeSeriesValue\"\n ? {\n time: (rawValue as ReferenceValue).timestamp,\n value: {\n type: \"Point\",\n coordinates: (rawValue as ReferenceValue).position,\n },\n }\n : undefined,\n );\n }\n if (propDef.type === \"mediaReference\") {\n return new MediaReferencePropertyImpl({\n client,\n objectApiName: objectDef.apiName,\n primaryKey: rawObject[objectDef.primaryKeyApiName as string],\n propertyName: p as string,\n });\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,yBAAyB,QAAQ,sCAAsC;AAChF,SAASC,0BAA0B,QAAQ,uCAAuC;AAClF,SAASC,sBAAsB,QAAQ,mCAAmC;AAI1E,SAASC,gCAAgC,QAAQ,gDAAgD;AACjG,SAASC,mCAAmC,QAAQ,oCAAoC;AAExF,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SACEC,SAAS,EACTC,YAAY,EACZC,oBAAoB,QACf,sBAAsB;AAG7B,MAAMC,oBAAoB,GAAG,IAAIC,GAAG,CAClC,CACE,YAAY,EACZ,wBAAwB,EACxB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,CAEtB,CAAC;;AAED;AACA;AACA,MAAMC,YAAY,GAAG;EACnB,KAAK,EAAE;IACLC,GAAG,EAAE,SAAAA,CAAA,EAA6B;MAChC,OAAOR,MAAM,CAAC,IAAI,CAACG,YAAY,CAAC,CAAC;IACnC;EACF,CAAC;EACD,OAAO,EAAE;IACPK,GAAG,EAAE,SAAAA,CAAA,EAA6B;MAChC,OAAOP,QAAQ,CAAC,IAAI,CAA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AK,EAAE;QACLsB,IAAI,EAAE,OAAO;QACbyB,WAAW,EAAGpB,QAAQ,CAAoBqB;MAC5C;IACF,CAAC,GACCC,SACN,CAAC;EACH;EACA,IAAIL,OAAO,CAACtB,IAAI,KAAK,gBAAgB,EAAE;IACrC,OAAO,IAAInC,0BAA0B,CAAC;MACpC0B,MAAM;MACNqC,aAAa,EAAEpC,SAAS,CAACP,OAAO;MAChC4C,UAAU,EAAET,SAAS,CAAC5B,SAAS,CAACT,iBAAiB,CAAW;MAC5D+C,YAAY,EAAET;IAChB,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
1
+ {"version":3,"file":"createOsdkObject.js","names":["invariant","GeotimeSeriesPropertyImpl","MediaReferencePropertyImpl","TimeSeriesPropertyImpl","hydrateAttachmentFromRidInternal","createObjectSpecifierFromPrimaryKey","get$as","get$link","ClientRef","ObjectDefRef","UnderlyingOsdkObject","specialPropertyTypes","Set","basePropDefs","get","value","update","rawObj","def","createOsdkObject","primaryKeyApiName","Error","apiName","titleProperty","$title","newObject","$primaryKey","enumerable","client","objectDef","simpleOsdkProperties","derivedPropertyTypeByName","Object","defineProperties","propKey","keys","properties","type","has","createSpecialProperty","modifyRdpProperties","freeze","rawValue","definition","operation","num","Number","isSafeInteger","process","env","NODE_ENV","selectedOrCollectedPropertyType","Array","isArray","map","a","rid","rawObject","p","propDef","time","timestamp","coordinates","position","undefined","objectApiName","primaryKey","propertyName","mediaReference"],"sources":["createOsdkObject.ts"],"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\nimport type { MediaReference } from \"@osdk/foundry.core\";\nimport type { Attachment, ReferenceValue } from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\nimport { GeotimeSeriesPropertyImpl } from \"../../createGeotimeSeriesProperty.js\";\nimport { MediaReferencePropertyImpl } from \"../../createMediaReferenceProperty.js\";\nimport { TimeSeriesPropertyImpl } from \"../../createTimeseriesProperty.js\";\nimport type { DerivedPropertyRuntimeMetadata } from \"../../derivedProperties/derivedPropertyRuntimeMetadata.js\";\nimport type { MinimalClient } from \"../../MinimalClientContext.js\";\nimport type { FetchedObjectTypeDefinition } from \"../../ontology/OntologyProvider.js\";\nimport { hydrateAttachmentFromRidInternal } from \"../../public-utils/hydrateAttachmentFromRid.js\";\nimport { createObjectSpecifierFromPrimaryKey } from \"../../util/objectSpecifierUtils.js\";\nimport type { SimpleOsdkProperties } from \"../SimpleOsdkProperties.js\";\nimport { get$as } from \"./getDollarAs.js\";\nimport { get$link } from \"./getDollarLink.js\";\nimport {\n ClientRef,\n ObjectDefRef,\n UnderlyingOsdkObject,\n} from \"./InternalSymbols.js\";\nimport type { ObjectHolder } from \"./ObjectHolder.js\";\n\nconst specialPropertyTypes = new Set(\n [\n \"attachment\",\n \"geotimeSeriesReference\",\n \"mediaReference\",\n \"numericTimeseries\",\n \"stringTimeseries\",\n \"sensorTimeseries\",\n ],\n);\n\n// kept separate so we are not redefining these functions\n// every time an object is created.\nconst basePropDefs = {\n \"$as\": {\n get: function(this: ObjectHolder) {\n return get$as(this[ObjectDefRef]);\n },\n },\n \"$link\": {\n get: function(this: ObjectHolder) {\n return get$link(this);\n },\n },\n \"$clone\": {\n value: function(\n this: ObjectHolder,\n update: Record<string, any> | undefined,\n ) {\n // I think `rawObj` is the same thing as `this` and can be removed?\n const rawObj = this[UnderlyingOsdkObject] as SimpleOsdkProperties;\n const def = this[ObjectDefRef];\n\n if (update == null) {\n return createOsdkObject(this[ClientRef], def, { ...rawObj });\n }\n\n if (\n def.primaryKeyApiName in update\n && rawObj[def.primaryKeyApiName] !== update[def.primaryKeyApiName]\n ) {\n throw new Error(\n `Cannot update ${def.apiName} object with differing primary key values `,\n );\n }\n\n if (def.titleProperty in update && !(\"$title\" in update)) {\n update.$title = update[def.titleProperty];\n }\n\n const newObject = { ...this[UnderlyingOsdkObject], ...update };\n return createOsdkObject(this[ClientRef], this[ObjectDefRef], newObject);\n },\n },\n \"$objectSpecifier\": {\n get: function(this: ObjectHolder) {\n const rawObj = this[UnderlyingOsdkObject];\n return createObjectSpecifierFromPrimaryKey(\n this[ObjectDefRef],\n rawObj.$primaryKey,\n );\n },\n enumerable: true,\n },\n};\n\n/**\n * @internal\n * @param client\n * @param objectDef\n * @param simpleOsdkProperties\n */\nexport function createOsdkObject(\n client: MinimalClient,\n objectDef: FetchedObjectTypeDefinition,\n simpleOsdkProperties: SimpleOsdkProperties,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata = {},\n): ObjectHolder {\n // updates the object's \"hidden class/map\".\n const rawObj = simpleOsdkProperties as ObjectHolder;\n Object.defineProperties(\n rawObj,\n {\n [UnderlyingOsdkObject]: {\n enumerable: false,\n value: simpleOsdkProperties,\n },\n [ObjectDefRef]: { value: objectDef, enumerable: false },\n [ClientRef]: { value: client, enumerable: false },\n ...basePropDefs,\n } satisfies Record<keyof ObjectHolder, PropertyDescriptor>,\n );\n\n // Assign the special values\n for (const propKey of Object.keys(rawObj)) {\n if (\n propKey in objectDef.properties\n && typeof (objectDef.properties[propKey].type) === \"string\"\n && specialPropertyTypes.has(objectDef.properties[propKey].type)\n ) {\n rawObj[propKey] = createSpecialProperty(\n client,\n objectDef,\n rawObj,\n propKey,\n );\n } else if (propKey in derivedPropertyTypeByName) {\n rawObj[propKey] = modifyRdpProperties(\n client,\n derivedPropertyTypeByName,\n rawObj[propKey],\n propKey,\n );\n }\n }\n\n return Object.freeze(rawObj);\n}\n\nfunction modifyRdpProperties(\n client: MinimalClient,\n derivedPropertyTypeByName: DerivedPropertyRuntimeMetadata,\n rawValue: any,\n propKey: string,\n): any {\n if (\n derivedPropertyTypeByName[propKey].definition.type === \"selection\"\n && derivedPropertyTypeByName[propKey].definition.operation.type\n === \"count\"\n ) {\n const num = Number(rawValue);\n invariant(\n Number.isSafeInteger(num),\n \"Count aggregation for derived property \" + propKey\n + \" returned a value larger than safe integer.\",\n );\n return num;\n } // Selected or collected properties need to be deserialized specially when constructed with RDP\n else if (\n derivedPropertyTypeByName[propKey].selectedOrCollectedPropertyType\n != null\n && typeof (derivedPropertyTypeByName[propKey]\n .selectedOrCollectedPropertyType.type)\n === \"string\"\n && specialPropertyTypes.has(\n derivedPropertyTypeByName[propKey].selectedOrCollectedPropertyType\n .type,\n )\n ) {\n switch (\n derivedPropertyTypeByName[propKey].selectedOrCollectedPropertyType\n ?.type\n ) {\n case \"attachment\":\n if (Array.isArray(rawValue)) {\n return rawValue.map(a =>\n hydrateAttachmentFromRidInternal(client, a.rid)\n );\n } else {\n return hydrateAttachmentFromRidInternal(\n client,\n (rawValue as Attachment).rid,\n );\n }\n break;\n default:\n invariant(\n false,\n \"Derived property aggregations for Timeseries and Media are not supported\",\n );\n }\n }\n return rawValue;\n}\n\nfunction createSpecialProperty(\n client: MinimalClient,\n objectDef: FetchedObjectTypeDefinition,\n rawObject: ObjectHolder,\n p: keyof typeof rawObject & string | symbol,\n) {\n const rawValue = rawObject[p as any];\n const propDef = objectDef.properties[p as any];\n if (process.env.NODE_ENV !== \"production\") {\n invariant(\n propDef != null && typeof propDef.type === \"string\"\n && specialPropertyTypes.has(propDef.type),\n );\n }\n if (propDef.type === \"attachment\") {\n if (Array.isArray(rawValue)) {\n return rawValue.map(a => hydrateAttachmentFromRidInternal(client, a.rid));\n }\n return hydrateAttachmentFromRidInternal(\n client,\n (rawValue as Attachment).rid,\n );\n }\n\n if (\n propDef.type === \"numericTimeseries\"\n || propDef.type === \"stringTimeseries\"\n || propDef.type === \"sensorTimeseries\"\n ) {\n return new TimeSeriesPropertyImpl<\n (typeof propDef)[\"type\"] extends \"numericTimeseries\" ? number\n : (typeof propDef)[\"type\"] extends \"stringTimeseries\" ? string\n : number | string\n >(\n client,\n objectDef.apiName,\n rawObject[objectDef.primaryKeyApiName as string],\n p as string,\n );\n }\n\n if (propDef.type === \"geotimeSeriesReference\") {\n return new GeotimeSeriesPropertyImpl<GeoJSON.Point>(\n client,\n objectDef.apiName,\n rawObject[objectDef.primaryKeyApiName as string],\n p as string,\n (rawValue as ReferenceValue).type === \"geotimeSeriesValue\"\n ? {\n time: (rawValue as ReferenceValue).timestamp,\n value: {\n type: \"Point\",\n coordinates: (rawValue as ReferenceValue).position,\n },\n }\n : undefined,\n );\n }\n if (propDef.type === \"mediaReference\") {\n return new MediaReferencePropertyImpl({\n client,\n objectApiName: objectDef.apiName,\n primaryKey: rawObject[objectDef.primaryKeyApiName as string],\n propertyName: p as string,\n mediaReference: rawValue as MediaReference,\n });\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,yBAAyB,QAAQ,sCAAsC;AAChF,SAASC,0BAA0B,QAAQ,uCAAuC;AAClF,SAASC,sBAAsB,QAAQ,mCAAmC;AAI1E,SAASC,gCAAgC,QAAQ,gDAAgD;AACjG,SAASC,mCAAmC,QAAQ,oCAAoC;AAExF,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SACEC,SAAS,EACTC,YAAY,EACZC,oBAAoB,QACf,sBAAsB;AAG7B,MAAMC,oBAAoB,GAAG,IAAIC,GAAG,CAClC,CACE,YAAY,EACZ,wBAAwB,EACxB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,CAEtB,CAAC;;AAED;AACA;AACA,MAAMC,YAAY,GAAG;EACnB,KAAK,EAAE;IACLC,GAAG,EAAE,SAAAA,CAAA,EAA6B;MAChC,OAAOR,MA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,SAAS,CAACT,iBAAiB,CAAW,EAChDsC,CAAC,EACAhB,QAAQ,CAAoBL,IAAI,KAAK,oBAAoB,GACtD;MACAuB,IAAI,EAAGlB,QAAQ,CAAoBmB,SAAS;MAC5C9C,KAAK,EAAE;QACLsB,IAAI,EAAE,OAAO;QACbyB,WAAW,EAAGpB,QAAQ,CAAoBqB;MAC5C;IACF,CAAC,GACCC,SACN,CAAC;EACH;EACA,IAAIL,OAAO,CAACtB,IAAI,KAAK,gBAAgB,EAAE;IACrC,OAAO,IAAInC,0BAA0B,CAAC;MACpC0B,MAAM;MACNqC,aAAa,EAAEpC,SAAS,CAACP,OAAO;MAChC4C,UAAU,EAAET,SAAS,CAAC5B,SAAS,CAACT,iBAAiB,CAAW;MAC5D+C,YAAY,EAAET,CAAW;MACzBU,cAAc,EAAE1B;IAClB,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
@@ -27,7 +27,7 @@ describe("media", () => {
27
27
  } = testSetup);
28
28
  testSetup.fauxFoundry.getDataStore($ontologyRid).registerMedia(objectTypeWithAllPropertyTypes.apiName, "mediaReference", new TextEncoder().encode(JSON.stringify({
29
29
  content: "Hello World"
30
- })), "application/json", "file1.txt", stubData.objectWithAllPropertyTypes1.mediaReference);
30
+ })), "application/json", "file1.txt", stubData.objectWithAllPropertyTypes1.mediaReference.reference.mediaSetViewItem.mediaItemRid);
31
31
  return () => {
32
32
  testSetup.apiServer.close();
33
33
  };
@@ -56,5 +56,24 @@ describe("media", () => {
56
56
  content: "Hello World"
57
57
  });
58
58
  });
59
+ it("gets media reference successfully", async () => {
60
+ const result = await client(objectTypeWithAllPropertyTypes).where({
61
+ id: stubData.objectWithAllPropertyTypes1.id
62
+ }).fetchPage();
63
+ const object1 = result.data[0];
64
+ expect(object1.mediaReference).toBeDefined();
65
+ const mediaReference = object1.mediaReference?.getMediaReference();
66
+ expect(mediaReference).toEqual({
67
+ mimeType: "application/pdf",
68
+ reference: {
69
+ type: "mediaSetViewItem",
70
+ mediaSetViewItem: {
71
+ mediaSetRid: "ri.mio.main.media-set.4153d42f-ca4b-4e42-8ca5-8e6aa7edb642",
72
+ mediaSetViewRid: "ri.mio.main.view.82a798ad-d637-4595-acc6-987bcf16629b",
73
+ mediaItemRid: "ri.mio.main.media-item.001ec98b-1620-4814-9e17-8e9c4e536225"
74
+ }
75
+ }
76
+ });
77
+ });
59
78
  });
60
79
  //# sourceMappingURL=media.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"media.test.js","names":["$ontologyRid","objectTypeWithAllPropertyTypes","LegacyFauxFoundry","startNodeApiServer","stubData","beforeAll","describe","expect","it","createClient","client","testSetup","fauxFoundry","getDataStore","registerMedia","apiName","TextEncoder","encode","JSON","stringify","content","objectWithAllPropertyTypes1","mediaReference","apiServer","close","result","where","id","fetchPage","object1","data","toBeDefined","mediaMetadata","fetchMetadata","toEqual","path","mediaType","sizeBytes","mediaContent","fetchContents","json"],"sources":["media.test.ts"],"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\nimport {\n $ontologyRid,\n objectTypeWithAllPropertyTypes,\n} from \"@osdk/client.test.ontology\";\nimport {\n LegacyFauxFoundry,\n startNodeApiServer,\n stubData,\n} from \"@osdk/shared.test\";\nimport { beforeAll, describe, expect, it } from \"vitest\";\nimport type { Client } from \"../Client.js\";\nimport { createClient } from \"../createClient.js\";\n\ndescribe(\"media\", () => {\n let client: Client;\n\n beforeAll(() => {\n const testSetup = startNodeApiServer(\n new LegacyFauxFoundry(),\n createClient,\n );\n\n ({ client } = testSetup);\n\n testSetup.fauxFoundry\n .getDataStore($ontologyRid)\n .registerMedia(\n objectTypeWithAllPropertyTypes.apiName,\n \"mediaReference\",\n new TextEncoder().encode(\n JSON.stringify({ content: \"Hello World\" }),\n ),\n \"application/json\",\n \"file1.txt\",\n stubData.objectWithAllPropertyTypes1.mediaReference,\n );\n\n return () => {\n testSetup.apiServer.close();\n };\n });\n\n it(\"reads media metadata successfully\", async () => {\n const result = await client(\n objectTypeWithAllPropertyTypes,\n )\n .where({ id: stubData.objectWithAllPropertyTypes1.id }).fetchPage();\n\n const object1 = result.data[0];\n expect(object1.mediaReference).toBeDefined();\n const mediaMetadata = await object1.mediaReference?.fetchMetadata();\n expect(mediaMetadata).toEqual({\n path: \"file1.txt\",\n mediaType: \"application/json\",\n sizeBytes: 25,\n });\n });\n\n it(\"reads media content successfully\", async () => {\n const result = await client(objectTypeWithAllPropertyTypes)\n .where({ id: stubData.objectWithAllPropertyTypes1.id }).fetchPage();\n\n const object1 = result.data[0];\n expect(object1.mediaReference).toBeDefined();\n const mediaContent = await object1?.mediaReference?.fetchContents();\n expect(await mediaContent!.json()).toEqual({\n content: \"Hello World\",\n });\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,YAAY,EACZC,8BAA8B,QACzB,4BAA4B;AACnC,SACEC,iBAAiB,EACjBC,kBAAkB,EAClBC,QAAQ,QACH,mBAAmB;AAC1B,SAASC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAExD,SAASC,YAAY,QAAQ,oBAAoB;AAEjDH,QAAQ,CAAC,OAAO,EAAE,MAAM;EACtB,IAAII,MAAc;EAElBL,SAAS,CAAC,MAAM;IACd,MAAMM,SAAS,GAAGR,kBAAkB,CAClC,IAAID,iBAAiB,CAAC,CAAC,EACvBO,YACF,CAAC;IAED,CAAC;MAAEC;IAAO,CAAC,GAAGC,SAAS;IAEvBA,S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IAAI,CAAC,CAAC,CAAC;IAC9BvB,MAAM,CAACsB,OAAO,CAACP,cAAc,CAAC,CAACS,WAAW,CAAC,CAAC;IAC5C,MAAMO,YAAY,GAAG,MAAMT,OAAO,EAAEP,cAAc,EAAEiB,aAAa,CAAC,CAAC;IACnEhC,MAAM,CAAC,MAAM+B,YAAY,CAAEE,IAAI,CAAC,CAAC,CAAC,CAACN,OAAO,CAAC;MACzCd,OAAO,EAAE;IACX,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"media.test.js","names":["$ontologyRid","objectTypeWithAllPropertyTypes","LegacyFauxFoundry","startNodeApiServer","stubData","beforeAll","describe","expect","it","createClient","client","testSetup","fauxFoundry","getDataStore","registerMedia","apiName","TextEncoder","encode","JSON","stringify","content","objectWithAllPropertyTypes1","mediaReference","reference","mediaSetViewItem","mediaItemRid","apiServer","close","result","where","id","fetchPage","object1","data","toBeDefined","mediaMetadata","fetchMetadata","toEqual","path","mediaType","sizeBytes","mediaContent","fetchContents","json","getMediaReference","mimeType","type","mediaSetRid","mediaSetViewRid"],"sources":["media.test.ts"],"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\nimport {\n $ontologyRid,\n objectTypeWithAllPropertyTypes,\n} from \"@osdk/client.test.ontology\";\nimport {\n LegacyFauxFoundry,\n startNodeApiServer,\n stubData,\n} from \"@osdk/shared.test\";\nimport { beforeAll, describe, expect, it } from \"vitest\";\nimport type { Client } from \"../Client.js\";\nimport { createClient } from \"../createClient.js\";\n\ndescribe(\"media\", () => {\n let client: Client;\n\n beforeAll(() => {\n const testSetup = startNodeApiServer(\n new LegacyFauxFoundry(),\n createClient,\n );\n\n ({ client } = testSetup);\n\n testSetup.fauxFoundry\n .getDataStore($ontologyRid)\n .registerMedia(\n objectTypeWithAllPropertyTypes.apiName,\n \"mediaReference\",\n new TextEncoder().encode(\n JSON.stringify({ content: \"Hello World\" }),\n ),\n \"application/json\",\n \"file1.txt\",\n stubData.objectWithAllPropertyTypes1.mediaReference.reference\n .mediaSetViewItem.mediaItemRid,\n );\n\n return () => {\n testSetup.apiServer.close();\n };\n });\n\n it(\"reads media metadata successfully\", async () => {\n const result = await client(\n objectTypeWithAllPropertyTypes,\n )\n .where({ id: stubData.objectWithAllPropertyTypes1.id }).fetchPage();\n\n const object1 = result.data[0];\n expect(object1.mediaReference).toBeDefined();\n const mediaMetadata = await object1.mediaReference?.fetchMetadata();\n expect(mediaMetadata).toEqual({\n path: \"file1.txt\",\n mediaType: \"application/json\",\n sizeBytes: 25,\n });\n });\n\n it(\"reads media content successfully\", async () => {\n const result = await client(objectTypeWithAllPropertyTypes)\n .where({ id: stubData.objectWithAllPropertyTypes1.id }).fetchPage();\n\n const object1 = result.data[0];\n expect(object1.mediaReference).toBeDefined();\n const mediaContent = await object1?.mediaReference?.fetchContents();\n expect(await mediaContent!.json()).toEqual({\n content: \"Hello World\",\n });\n });\n\n it(\"gets media reference successfully\", async () => {\n const result = await client(objectTypeWithAllPropertyTypes)\n .where({ id: stubData.objectWithAllPropertyTypes1.id }).fetchPage();\n\n const object1 = result.data[0];\n expect(object1.mediaReference).toBeDefined();\n const mediaReference = object1.mediaReference?.getMediaReference();\n expect(mediaReference).toEqual({\n mimeType: \"application/pdf\",\n reference: {\n type: \"mediaSetViewItem\",\n mediaSetViewItem: {\n mediaSetRid:\n \"ri.mio.main.media-set.4153d42f-ca4b-4e42-8ca5-8e6aa7edb642\",\n mediaSetViewRid:\n \"ri.mio.main.view.82a798ad-d637-4595-acc6-987bcf16629b\",\n mediaItemRid:\n \"ri.mio.main.media-item.001ec98b-1620-4814-9e17-8e9c4e536225\",\n },\n },\n });\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,YAAY,EACZC,8BAA8B,QACzB,4BAA4B;AACnC,SACEC,iBAAiB,EACjBC,kBAAkB,EAClBC,QAAQ,QACH,mBAAmB;AAC1B,SAASC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAExD,SAASC,YAAY,QAAQ,oBAAoB;AAEjDH,QAAQ,CAAC,OAAO,EAAE,MAAM;EACtB,IAAII,MAAc;EAElBL,SAAS,CAAC,MAAM;IACd,MAAMM,SAAS,GAAGR,kBAAkB,CAClC,IAAID,iBAAiB,CAAC,CAAC,EACvBO,YACF,CAAC;IAED,CAAC;MAAEC;IAAO,CAAC,GAAGC,SAAS;IAEvBA,SAAS,CAACC,WAAW,CAClBC,YAAY,CAACb,YAAY,CAAC,CAC1Bc,aAAa,CACZb,8BAA8B,CAACc,OAAO,EACtC,gBAAgB,EAChB,IAAIC,WAAW,CAAC,CAAC,CAACC,MAAM,CACtBC,IAAI,CAACC,SAAS,CAAC;MAAEC,OAAO,EAAE;IAAc,CAAC,CAC3C,CAAC,EACD,kBAAkB,EAClB,WAAW,EACXhB,QAAQ,CAACiB,2BAA2B,CAACC,cAAc,CAACC,SAAS,CAC1DC,gBAAgB,CAACC,YACtB,CAAC;IAEH,OAAO,MAAM;MACXd,SAAS,CAACe,SAAS,CAACC,KAAK,CAAC,CAAC;IAC7B,CAAC;EACH,CAAC,CAAC;EAEFnB,EAAE,CAAC,mCAAmC,EAAE,YAAY;IAClD,MAAMoB,MAAM,GAAG,MAAMlB,MAAM,CACzBT,8BACF,CAAC,CACE4B,KAAK,CAAC;MAAEC,EAAE,EAAE1B,QAAQ,CAACiB,2BAA2B,CAACS;IAAG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ACK,IAAI,CAAC,CAAC,CAAC;IAC9B1B,MAAM,CAACyB,OAAO,CAACV,cAAc,CAAC,CAACY,WAAW,CAAC,CAAC;IAC5C,MAAMZ,cAAc,GAAGU,OAAO,CAACV,cAAc,EAAEsB,iBAAiB,CAAC,CAAC;IAClErC,MAAM,CAACe,cAAc,CAAC,CAACe,OAAO,CAAC;MAC7BQ,QAAQ,EAAE,iBAAiB;MAC3BtB,SAAS,EAAE;QACTuB,IAAI,EAAE,kBAAkB;QACxBtB,gBAAgB,EAAE;UAChBuB,WAAW,EACT,4DAA4D;UAC9DC,eAAe,EACb,uDAAuD;UACzDvB,YAAY,EACV;QACJ;MACF;IACF,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -14,5 +14,5 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- export const USER_AGENT = `osdk-client/${"2.2.0"}`;
17
+ export const USER_AGENT = `osdk-client/${"2.2.1"}`;
18
18
  //# sourceMappingURL=UserAgent.js.map
@@ -16,7 +16,7 @@ export interface Client extends SharedClient, OldSharedClient {
16
16
  <Q extends Experiment<"2.0.8"> | Experiment<"2.1.0"> | Experiment<"2.2.0">>(experiment: Q): ExperimentFns<Q>;
17
17
  fetchMetadata<Q extends (ObjectTypeDefinition | InterfaceDefinition | ActionDefinition<any> | QueryDefinition<any>)>(o: Q): Promise<Q extends ObjectTypeDefinition ? ObjectMetadata : Q extends InterfaceDefinition ? InterfaceMetadata : Q extends ActionDefinition<any> ? ActionMetadata : Q extends QueryDefinition<any> ? QueryMetadata : never>;
18
18
  }
19
- declare const MaxOsdkVersion = "2.2.0";
19
+ declare const MaxOsdkVersion = "2.2.1";
20
20
  export type MaxOsdkVersion = typeof MaxOsdkVersion;
21
21
  declare const ErrorMessage: unique symbol;
22
22
  export {};
@@ -1,4 +1,5 @@
1
- import type { Media, MediaMetadata } from "@osdk/api";
1
+ import type { Media, MediaMetadata, MediaReference } from "@osdk/api";
2
+ import type { MediaReference as CoreMediaReference } from "@osdk/foundry.core";
2
3
  import type { MinimalClient } from "./MinimalClientContext.js";
3
4
  export declare class MediaReferencePropertyImpl implements Media {
4
5
  #private;
@@ -7,7 +8,9 @@ export declare class MediaReferencePropertyImpl implements Media {
7
8
  objectApiName: string
8
9
  primaryKey: any
9
10
  propertyName: string
11
+ mediaReference: CoreMediaReference
10
12
  });
11
13
  fetchContents(): Promise<Response>;
12
14
  fetchMetadata(): Promise<MediaMetadata>;
15
+ getMediaReference(): MediaReference;
13
16
  }
@@ -1 +1 @@
1
- {"mappings":"AAgBA,cAAc,OAAO,qBAAqB,WAAY;AAEtD,cAAc,qBAAqB,2BAA4B;AAE/D,OAAO,cAAM,sCAAsC,MAAM;;CAIvD,YAAYA,MAAM;EAChB,QAAQ;EACR;EACA;EACA;CACD;CAMD,AAAa,iBAAiB,QAAQ;CAWtC,AAAa,iBAAiB,QAAQ;AAevC","names":["args: {\n client: MinimalClient;\n objectApiName: string;\n primaryKey: any;\n propertyName: string;\n }"],"sources":["../../src/createMediaReferenceProperty.ts"],"version":3,"file":"createMediaReferenceProperty.d.ts"}
1
+ {"mappings":"AAgBA,cAAc,OAAO,eAAe,sBAAsB,WAAY;AACtE,cAAc,kBAAkB,0BAA0B,oBAAqB;AAE/E,cAAc,qBAAqB,2BAA4B;AAE/D,OAAO,cAAM,sCAAsC,MAAM;;CAKvD,YAAYA,MAAM;EAChB,QAAQ;EACR;EACA;EACA;EACA,gBAAgB;CACjB;CAaD,AAAa,iBAAiB,QAAQ;CAWtC,AAAa,iBAAiB,QAAQ;CAgBtC,AAAO,qBAAqB;AAG7B","names":["args: {\n client: MinimalClient;\n objectApiName: string;\n primaryKey: any;\n propertyName: string;\n mediaReference: CoreMediaReference;\n }"],"sources":["../../src/createMediaReferenceProperty.ts"],"version":3,"file":"createMediaReferenceProperty.d.ts"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osdk/client",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "",
5
5
  "access": "public",
6
6
  "license": "Apache-2.0",
@@ -65,12 +65,12 @@
65
65
  "tiny-invariant": "^1.3.1",
66
66
  "type-fest": "^4.18.2",
67
67
  "ws": "^8.18.0",
68
- "@osdk/api": "~2.2.0",
69
- "@osdk/client.unstable": "2.2.0",
68
+ "@osdk/api": "~2.2.1",
69
+ "@osdk/client.unstable": "2.2.1",
70
70
  "@osdk/shared.client.impl": "~1.2.0",
71
71
  "@osdk/shared.net.errors": "~2.2.0",
72
72
  "@osdk/shared.net.fetch": "~1.2.0",
73
- "@osdk/generator-converters": "2.2.0"
73
+ "@osdk/generator-converters": "2.2.1"
74
74
  },
75
75
  "devDependencies": {
76
76
  "@microsoft/api-documenter": "^7.26.5",
@@ -91,10 +91,10 @@
91
91
  "ts-expect": "^1.3.0",
92
92
  "typescript": "~5.5.4",
93
93
  "zod": "^3.23.8",
94
+ "@osdk/client.test.ontology": "~2.2.1",
94
95
  "@osdk/monorepo.api-extractor": "~0.1.0",
95
- "@osdk/client.test.ontology": "~2.2.0",
96
- "@osdk/shared.test": "~2.2.0",
97
- "@osdk/monorepo.tsconfig": "~0.1.0"
96
+ "@osdk/monorepo.tsconfig": "~0.1.0",
97
+ "@osdk/shared.test": "~2.2.1"
98
98
  },
99
99
  "publishConfig": {
100
100
  "access": "public"