@osdk/functions 1.6.0-beta.3 → 1.6.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 +13 -0
- package/build/browser/aliases/custom.js +26 -0
- package/build/browser/aliases/custom.js.map +1 -0
- package/build/browser/aliases/environment.js +48 -0
- package/build/browser/aliases/environment.js.map +1 -0
- package/build/browser/aliases/index.js +19 -0
- package/build/browser/aliases/index.js.map +1 -0
- package/build/browser/aliases/loaders.js +66 -0
- package/build/browser/aliases/loaders.js.map +1 -0
- package/build/browser/aliases/model.js +26 -0
- package/build/browser/aliases/model.js.map +1 -0
- package/build/browser/aliases/types.js +30 -0
- package/build/browser/aliases/types.js.map +1 -0
- package/build/browser/edits/EditBatch.js.map +1 -1
- package/build/browser/index.js +1 -0
- package/build/browser/index.js.map +1 -1
- package/build/cjs/{EditBatch-CwPxevhT.d.cts → EditBatch-DenXqhoa.d.cts} +2 -2
- package/build/cjs/index.cjs +133 -0
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +21 -2
- package/build/cjs/public/experimental.d.cts +1 -1
- package/build/cjs/public/unstable-do-not-use.d.cts +1 -1
- package/build/esm/aliases/custom.js +26 -0
- package/build/esm/aliases/custom.js.map +1 -0
- package/build/esm/aliases/environment.js +48 -0
- package/build/esm/aliases/environment.js.map +1 -0
- package/build/esm/aliases/index.js +19 -0
- package/build/esm/aliases/index.js.map +1 -0
- package/build/esm/aliases/loaders.js +66 -0
- package/build/esm/aliases/loaders.js.map +1 -0
- package/build/esm/aliases/model.js +26 -0
- package/build/esm/aliases/model.js.map +1 -0
- package/build/esm/aliases/types.js +30 -0
- package/build/esm/aliases/types.js.map +1 -0
- package/build/esm/edits/EditBatch.js.map +1 -1
- package/build/esm/index.js +1 -0
- package/build/esm/index.js.map +1 -1
- package/build/types/aliases/custom.d.ts +3 -0
- package/build/types/aliases/custom.d.ts.map +1 -0
- package/build/types/aliases/environment.d.ts +6 -0
- package/build/types/aliases/environment.d.ts.map +1 -0
- package/build/types/aliases/index.d.ts +2 -0
- package/build/types/aliases/index.d.ts.map +1 -0
- package/build/types/aliases/loaders.d.ts +3 -0
- package/build/types/aliases/loaders.d.ts.map +1 -0
- package/build/types/aliases/model.d.ts +3 -0
- package/build/types/aliases/model.d.ts.map +1 -0
- package/build/types/aliases/types.d.ts +40 -0
- package/build/types/aliases/types.d.ts.map +1 -0
- package/build/types/edits/EditBatch.d.ts +2 -2
- package/build/types/edits/EditBatch.d.ts.map +1 -1
- package/build/types/index.d.ts +1 -0
- package/build/types/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/build/browser/edits/createEditBatch.test.js +0 -519
- package/build/browser/edits/createEditBatch.test.js.map +0 -1
- package/build/browser/transactions/EditRequestManager.test.js +0 -311
- package/build/browser/transactions/EditRequestManager.test.js.map +0 -1
- package/build/esm/edits/createEditBatch.test.js +0 -519
- package/build/esm/edits/createEditBatch.test.js.map +0 -1
- package/build/esm/transactions/EditRequestManager.test.js +0 -311
- package/build/esm/transactions/EditRequestManager.test.js.map +0 -1
- package/build/types/edits/createEditBatch.test.d.ts +0 -1
- package/build/types/edits/createEditBatch.test.d.ts.map +0 -1
- package/build/types/transactions/EditRequestManager.test.d.ts +0 -1
- package/build/types/transactions/EditRequestManager.test.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @osdk/functions
|
|
2
2
|
|
|
3
|
+
## 1.6.0-beta.4
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 7538b79: Allow link/unlink edits for ONE direction links
|
|
8
|
+
- 34a5ad2: Add helper functions for resolving custom and model aliases in functions
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies [09e5659]
|
|
13
|
+
- Updated dependencies [2ebe62c]
|
|
14
|
+
- @osdk/client@2.8.0-beta.16
|
|
15
|
+
|
|
3
16
|
## 1.6.0-beta.3
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { loadResolvedAliases } from "./loaders.js";
|
|
18
|
+
export function custom(alias) {
|
|
19
|
+
const resolvedAliases = loadResolvedAliases();
|
|
20
|
+
if (!(alias in resolvedAliases.custom)) {
|
|
21
|
+
const available = Object.keys(resolvedAliases.custom);
|
|
22
|
+
throw new Error(`Custom alias '${alias}' not found. Available aliases: [${available.join(", ")}]`);
|
|
23
|
+
}
|
|
24
|
+
return resolvedAliases.custom[alias];
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=custom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom.js","names":["loadResolvedAliases","custom","alias","resolvedAliases","available","Object","keys","Error","join"],"sources":["custom.ts"],"sourcesContent":["/*\n * Copyright 2026 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 { loadResolvedAliases } from \"./loaders.js\";\nimport type { Custom } from \"./types.js\";\nexport type { Custom } from \"./types.js\";\n\nexport function custom(alias: string): Custom {\n const resolvedAliases = loadResolvedAliases();\n\n if (!(alias in resolvedAliases.custom)) {\n const available = Object.keys(resolvedAliases.custom);\n throw new Error(\n `Custom alias '${alias}' not found. Available aliases: [${\n available.join(\", \")\n }]`,\n );\n }\n\n return resolvedAliases.custom[alias] as Custom;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,mBAAmB,QAAQ,cAAc;AAIlD,OAAO,SAASC,MAAMA,CAACC,KAAa,EAAU;EAC5C,MAAMC,eAAe,GAAGH,mBAAmB,CAAC,CAAC;EAE7C,IAAI,EAAEE,KAAK,IAAIC,eAAe,CAACF,MAAM,CAAC,EAAE;IACtC,MAAMG,SAAS,GAAGC,MAAM,CAACC,IAAI,CAACH,eAAe,CAACF,MAAM,CAAC;IACrD,MAAM,IAAIM,KAAK,CACb,iBAAiBL,KAAK,oCACpBE,SAAS,CAACI,IAAI,CAAC,IAAI,CAAC,GAExB,CAAC;EACH;EAEA,OAAOL,eAAe,CAACF,MAAM,CAACC,KAAK,CAAC;AACtC","ignoreList":[]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { AliasEnvironment } from "./types.js";
|
|
18
|
+
export const ALIASES_JSON_FILE_ENV_VAR = "ALIASES_JSON_FILE";
|
|
19
|
+
export const RESOURCES_JSON_FILE_ENV_VAR = "RESOURCES_JSON_FILE";
|
|
20
|
+
export function detectEnvironment() {
|
|
21
|
+
const aliasesFileSet = ALIASES_JSON_FILE_ENV_VAR in process.env;
|
|
22
|
+
const resourcesFileSet = RESOURCES_JSON_FILE_ENV_VAR in process.env;
|
|
23
|
+
if (aliasesFileSet && resourcesFileSet) {
|
|
24
|
+
throw new Error(`Ambiguous alias configuration: both ${ALIASES_JSON_FILE_ENV_VAR} and ` + `${RESOURCES_JSON_FILE_ENV_VAR} are set. Only one should be configured.`);
|
|
25
|
+
}
|
|
26
|
+
if (aliasesFileSet) {
|
|
27
|
+
return AliasEnvironment.PUBLISHED;
|
|
28
|
+
}
|
|
29
|
+
if (resourcesFileSet) {
|
|
30
|
+
return AliasEnvironment.LIVE_PREVIEW;
|
|
31
|
+
}
|
|
32
|
+
throw new Error(`Unknown alias environment: neither ${ALIASES_JSON_FILE_ENV_VAR} nor ${RESOURCES_JSON_FILE_ENV_VAR} is set.`);
|
|
33
|
+
}
|
|
34
|
+
export function getAliasesFilePath() {
|
|
35
|
+
const path = process.env[ALIASES_JSON_FILE_ENV_VAR];
|
|
36
|
+
if (path == null) {
|
|
37
|
+
throw new Error(`${ALIASES_JSON_FILE_ENV_VAR} environment variable is not set`);
|
|
38
|
+
}
|
|
39
|
+
return path;
|
|
40
|
+
}
|
|
41
|
+
export function getResourcesFilePath() {
|
|
42
|
+
const path = process.env[RESOURCES_JSON_FILE_ENV_VAR];
|
|
43
|
+
if (path == null) {
|
|
44
|
+
throw new Error(`${RESOURCES_JSON_FILE_ENV_VAR} environment variable is not set`);
|
|
45
|
+
}
|
|
46
|
+
return path;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=environment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.js","names":["AliasEnvironment","ALIASES_JSON_FILE_ENV_VAR","RESOURCES_JSON_FILE_ENV_VAR","detectEnvironment","aliasesFileSet","process","env","resourcesFileSet","Error","PUBLISHED","LIVE_PREVIEW","getAliasesFilePath","path","getResourcesFilePath"],"sources":["environment.ts"],"sourcesContent":["/*\n * Copyright 2026 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 { AliasEnvironment } from \"./types.js\";\n\nexport const ALIASES_JSON_FILE_ENV_VAR = \"ALIASES_JSON_FILE\";\nexport const RESOURCES_JSON_FILE_ENV_VAR = \"RESOURCES_JSON_FILE\";\n\nexport function detectEnvironment(): AliasEnvironment {\n const aliasesFileSet = ALIASES_JSON_FILE_ENV_VAR in process.env;\n const resourcesFileSet = RESOURCES_JSON_FILE_ENV_VAR in process.env;\n\n if (aliasesFileSet && resourcesFileSet) {\n throw new Error(\n `Ambiguous alias configuration: both ${ALIASES_JSON_FILE_ENV_VAR} and `\n + `${RESOURCES_JSON_FILE_ENV_VAR} are set. Only one should be configured.`,\n );\n }\n\n if (aliasesFileSet) {\n return AliasEnvironment.PUBLISHED;\n }\n if (resourcesFileSet) {\n return AliasEnvironment.LIVE_PREVIEW;\n }\n\n throw new Error(\n `Unknown alias environment: neither ${ALIASES_JSON_FILE_ENV_VAR} nor ${RESOURCES_JSON_FILE_ENV_VAR} is set.`,\n );\n}\n\nexport function getAliasesFilePath(): string {\n const path = process.env[ALIASES_JSON_FILE_ENV_VAR];\n if (path == null) {\n throw new Error(\n `${ALIASES_JSON_FILE_ENV_VAR} environment variable is not set`,\n );\n }\n return path;\n}\n\nexport function getResourcesFilePath(): string {\n const path = process.env[RESOURCES_JSON_FILE_ENV_VAR];\n if (path == null) {\n throw new Error(\n `${RESOURCES_JSON_FILE_ENV_VAR} environment variable is not set`,\n );\n }\n return path;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,gBAAgB,QAAQ,YAAY;AAE7C,OAAO,MAAMC,yBAAyB,GAAG,mBAAmB;AAC5D,OAAO,MAAMC,2BAA2B,GAAG,qBAAqB;AAEhE,OAAO,SAASC,iBAAiBA,CAAA,EAAqB;EACpD,MAAMC,cAAc,GAAGH,yBAAyB,IAAII,OAAO,CAACC,GAAG;EAC/D,MAAMC,gBAAgB,GAAGL,2BAA2B,IAAIG,OAAO,CAACC,GAAG;EAEnE,IAAIF,cAAc,IAAIG,gBAAgB,EAAE;IACtC,MAAM,IAAIC,KAAK,CACb,uCAAuCP,yBAAyB,OAAO,GACnE,GAAGC,2BAA2B,0CACpC,CAAC;EACH;EAEA,IAAIE,cAAc,EAAE;IAClB,OAAOJ,gBAAgB,CAACS,SAAS;EACnC;EACA,IAAIF,gBAAgB,EAAE;IACpB,OAAOP,gBAAgB,CAACU,YAAY;EACtC;EAEA,MAAM,IAAIF,KAAK,CACb,sCAAsCP,yBAAyB,QAAQC,2BAA2B,UACpG,CAAC;AACH;AAEA,OAAO,SAASS,kBAAkBA,CAAA,EAAW;EAC3C,MAAMC,IAAI,GAAGP,OAAO,CAACC,GAAG,CAACL,yBAAyB,CAAC;EACnD,IAAIW,IAAI,IAAI,IAAI,EAAE;IAChB,MAAM,IAAIJ,KAAK,CACb,GAAGP,yBAAyB,kCAC9B,CAAC;EACH;EACA,OAAOW,IAAI;AACb;AAEA,OAAO,SAASC,oBAAoBA,CAAA,EAAW;EAC7C,MAAMD,IAAI,GAAGP,OAAO,CAACC,GAAG,CAACJ,2BAA2B,CAAC;EACrD,IAAIU,IAAI,IAAI,IAAI,EAAE;IAChB,MAAM,IAAIJ,KAAK,CACb,GAAGN,2BAA2B,kCAChC,CAAC;EACH;EACA,OAAOU,IAAI;AACb","ignoreList":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export * from "./custom.js";
|
|
18
|
+
export * from "./model.js";
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["index.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from \"./custom.js\";\nexport * from \"./model.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,aAAa;AAC3B,cAAc,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import * as fs from "fs";
|
|
18
|
+
import { detectEnvironment, getAliasesFilePath, getResourcesFilePath } from "./environment.js";
|
|
19
|
+
import { AliasEnvironment } from "./types.js";
|
|
20
|
+
let cachedPublishedAliases;
|
|
21
|
+
function loadPublishedAliases() {
|
|
22
|
+
if (cachedPublishedAliases !== undefined) {
|
|
23
|
+
return cachedPublishedAliases;
|
|
24
|
+
}
|
|
25
|
+
const aliasesPath = getAliasesFilePath();
|
|
26
|
+
if (!fs.existsSync(aliasesPath)) {
|
|
27
|
+
throw new Error(`Aliases file not found at ${aliasesPath}`);
|
|
28
|
+
}
|
|
29
|
+
const data = fs.readFileSync(aliasesPath, "utf-8");
|
|
30
|
+
const aliasesFile = JSON.parse(data);
|
|
31
|
+
cachedPublishedAliases = {
|
|
32
|
+
custom: aliasesFile.defaults.custom,
|
|
33
|
+
models: Object.fromEntries(Object.entries(aliasesFile.defaults.models).map(([alias, {
|
|
34
|
+
id: identifier
|
|
35
|
+
}]) => [alias, identifier]))
|
|
36
|
+
};
|
|
37
|
+
return cachedPublishedAliases;
|
|
38
|
+
}
|
|
39
|
+
function loadPreviewAliases() {
|
|
40
|
+
const resourcesPath = getResourcesFilePath();
|
|
41
|
+
if (!fs.existsSync(resourcesPath)) {
|
|
42
|
+
throw new Error(`Resources file not found at ${resourcesPath}`);
|
|
43
|
+
}
|
|
44
|
+
const data = fs.readFileSync(resourcesPath, "utf-8");
|
|
45
|
+
const resourcesFile = JSON.parse(data);
|
|
46
|
+
return {
|
|
47
|
+
custom: resourcesFile.resources.custom,
|
|
48
|
+
models: Object.fromEntries(resourcesFile.resources.models.filter(model => model.alias != null).map(({
|
|
49
|
+
alias,
|
|
50
|
+
identifier
|
|
51
|
+
}) => [alias, identifier]))
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export function resetPublishedCache() {
|
|
55
|
+
cachedPublishedAliases = undefined;
|
|
56
|
+
}
|
|
57
|
+
export function loadResolvedAliases() {
|
|
58
|
+
const environment = detectEnvironment();
|
|
59
|
+
switch (environment) {
|
|
60
|
+
case AliasEnvironment.PUBLISHED:
|
|
61
|
+
return loadPublishedAliases();
|
|
62
|
+
case AliasEnvironment.LIVE_PREVIEW:
|
|
63
|
+
return loadPreviewAliases();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=loaders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loaders.js","names":["fs","detectEnvironment","getAliasesFilePath","getResourcesFilePath","AliasEnvironment","cachedPublishedAliases","loadPublishedAliases","undefined","aliasesPath","existsSync","Error","data","readFileSync","aliasesFile","JSON","parse","custom","defaults","models","Object","fromEntries","entries","map","alias","id","identifier","loadPreviewAliases","resourcesPath","resourcesFile","resources","filter","model","resetPublishedCache","loadResolvedAliases","environment","PUBLISHED","LIVE_PREVIEW"],"sources":["loaders.ts"],"sourcesContent":["/*\n * Copyright 2026 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 * as fs from \"fs\";\nimport {\n detectEnvironment,\n getAliasesFilePath,\n getResourcesFilePath,\n} from \"./environment.js\";\nimport { AliasEnvironment } from \"./types.js\";\nimport type {\n AliasesFile,\n Model,\n ModelResource,\n ResolvedAliases,\n ResourcesFile,\n} from \"./types.js\";\n\nlet cachedPublishedAliases: ResolvedAliases | undefined;\n\nfunction loadPublishedAliases(): ResolvedAliases {\n if (cachedPublishedAliases !== undefined) {\n return cachedPublishedAliases;\n }\n const aliasesPath = getAliasesFilePath();\n if (!fs.existsSync(aliasesPath)) {\n throw new Error(`Aliases file not found at ${aliasesPath}`);\n }\n\n const data = fs.readFileSync(aliasesPath, \"utf-8\");\n const aliasesFile = JSON.parse(data) as AliasesFile;\n\n cachedPublishedAliases = {\n custom: aliasesFile.defaults.custom,\n models: Object.fromEntries<Model>(\n Object.entries(aliasesFile.defaults.models).map((\n [alias, { id: identifier }],\n ) => [alias, identifier]),\n ),\n };\n return cachedPublishedAliases;\n}\n\nfunction loadPreviewAliases(): ResolvedAliases {\n const resourcesPath = getResourcesFilePath();\n if (!fs.existsSync(resourcesPath)) {\n throw new Error(`Resources file not found at ${resourcesPath}`);\n }\n\n const data = fs.readFileSync(resourcesPath, \"utf-8\");\n const resourcesFile = JSON.parse(data) as ResourcesFile;\n\n return {\n custom: resourcesFile.resources.custom,\n models: Object.fromEntries<Model>(\n resourcesFile.resources.models\n .filter((model): model is ModelResource & { alias: string } =>\n model.alias != null\n )\n .map(({ alias, identifier }) => [alias, identifier]),\n ),\n };\n}\n\nexport function resetPublishedCache(): void {\n cachedPublishedAliases = undefined;\n}\n\nexport function loadResolvedAliases(): ResolvedAliases {\n const environment = detectEnvironment();\n switch (environment) {\n case AliasEnvironment.PUBLISHED:\n return loadPublishedAliases();\n case AliasEnvironment.LIVE_PREVIEW:\n return loadPreviewAliases();\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,KAAKA,EAAE,MAAM,IAAI;AACxB,SACEC,iBAAiB,EACjBC,kBAAkB,EAClBC,oBAAoB,QACf,kBAAkB;AACzB,SAASC,gBAAgB,QAAQ,YAAY;AAS7C,IAAIC,sBAAmD;AAEvD,SAASC,oBAAoBA,CAAA,EAAoB;EAC/C,IAAID,sBAAsB,KAAKE,SAAS,EAAE;IACxC,OAAOF,sBAAsB;EAC/B;EACA,MAAMG,WAAW,GAAGN,kBAAkB,CAAC,CAAC;EACxC,IAAI,CAACF,EAAE,CAACS,UAAU,CAACD,WAAW,CAAC,EAAE;IAC/B,MAAM,IAAIE,KAAK,CAAC,6BAA6BF,WAAW,EAAE,CAAC;EAC7D;EAEA,MAAMG,IAAI,GAAGX,EAAE,CAACY,YAAY,CAACJ,WAAW,EAAE,OAAO,CAAC;EAClD,MAAMK,WAAW,GAAGC,IAAI,CAACC,KAAK,CAACJ,IAAI,CAAgB;EAEnDN,sBAAsB,GAAG;IACvBW,MAAM,EAAEH,WAAW,CAACI,QAAQ,CAACD,MAAM;IACnCE,MAAM,EAAEC,MAAM,CAACC,WAAW,CACxBD,MAAM,CAACE,OAAO,CAACR,WAAW,CAACI,QAAQ,CAACC,MAAM,CAAC,CAACI,GAAG,CAAC,CAC9C,CAACC,KAAK,EAAE;MAAEC,EAAE,EAAEC;IAAW,CAAC,CAAC,KACxB,CAACF,KAAK,EAAEE,UAAU,CAAC,CAC1B;EACF,CAAC;EACD,OAAOpB,sBAAsB;AAC/B;AAEA,SAASqB,kBAAkBA,CAAA,EAAoB;EAC7C,MAAMC,aAAa,GAAGxB,oBAAoB,CAAC,CAAC;EAC5C,IAAI,CAACH,EAAE,CAACS,UAAU,CAACkB,aAAa,CAAC,EAAE;IACjC,MAAM,IAAIjB,KAAK,CAAC,+BAA+BiB,aAAa,EAAE,CAAC;EACjE;EAEA,MAAMhB,IAAI,GAAGX,EAAE,CAACY,YAAY,CAACe,aAAa,EAAE,OAAO,CAAC;EACpD,MAAMC,aAAa,GAAGd,IAAI,CAACC,KAAK,CAACJ,IAAI,CAAkB;EAEvD,OAAO;IACLK,MAAM,EAAEY,aAAa,CAACC,SAAS,CAACb,MAAM;IACtCE,MAAM,EAAEC,MAAM,CAACC,WAAW,CACxBQ,aAAa,CAACC,SAAS,CAACX,MAAM,CAC3BY,MAAM,CAAEC,KAAK,IACZA,KAAK,CAACR,KAAK,IAAI,IACjB,CAAC,CACAD,GAAG,CAAC,CAAC;MAAEC,KAAK;MAAEE;IAAW,CAAC,KAAK,CAACF,KAAK,EAAEE,UAAU,CAAC,CACvD;EACF,CAAC;AACH;AAEA,OAAO,SAASO,mBAAmBA,CAAA,EAAS;EAC1C3B,sBAAsB,GAAGE,SAAS;AACpC;AAEA,OAAO,SAAS0B,mBAAmBA,CAAA,EAAoB;EACrD,MAAMC,WAAW,GAAGjC,iBAAiB,CAAC,CAAC;EACvC,QAAQiC,WAAW;IACjB,KAAK9B,gBAAgB,CAAC+B,SAAS;MAC7B,OAAO7B,oBAAoB,CAAC,CAAC;IAC/B,KAAKF,gBAAgB,CAACgC,YAAY;MAChC,OAAOV,kBAAkB,CAAC,CAAC;EAC/B;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { loadResolvedAliases } from "./loaders.js";
|
|
18
|
+
export function model(alias) {
|
|
19
|
+
const resolvedAliases = loadResolvedAliases();
|
|
20
|
+
if (!(alias in resolvedAliases.models)) {
|
|
21
|
+
const available = Object.keys(resolvedAliases.models);
|
|
22
|
+
throw new Error(`Model alias '${alias}' not found. Available aliases: [${available.join(", ")}]`);
|
|
23
|
+
}
|
|
24
|
+
return resolvedAliases.models[alias];
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","names":["loadResolvedAliases","model","alias","resolvedAliases","models","available","Object","keys","Error","join"],"sources":["model.ts"],"sourcesContent":["/*\n * Copyright 2026 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 { loadResolvedAliases } from \"./loaders.js\";\nimport type { Model } from \"./types.js\";\nexport type { Model } from \"./types.js\";\n\nexport function model(alias: string): Model {\n const resolvedAliases = loadResolvedAliases();\n\n if (!(alias in resolvedAliases.models)) {\n const available = Object.keys(resolvedAliases.models);\n throw new Error(\n `Model alias '${alias}' not found. Available aliases: [${\n available.join(\", \")\n }]`,\n );\n }\n\n return resolvedAliases.models[alias];\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,mBAAmB,QAAQ,cAAc;AAIlD,OAAO,SAASC,KAAKA,CAACC,KAAa,EAAS;EAC1C,MAAMC,eAAe,GAAGH,mBAAmB,CAAC,CAAC;EAE7C,IAAI,EAAEE,KAAK,IAAIC,eAAe,CAACC,MAAM,CAAC,EAAE;IACtC,MAAMC,SAAS,GAAGC,MAAM,CAACC,IAAI,CAACJ,eAAe,CAACC,MAAM,CAAC;IACrD,MAAM,IAAII,KAAK,CACb,gBAAgBN,KAAK,oCACnBG,SAAS,CAACI,IAAI,CAAC,IAAI,CAAC,GAExB,CAAC;EACH;EAEA,OAAON,eAAe,CAACC,MAAM,CAACF,KAAK,CAAC;AACtC","ignoreList":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
// Types relevant to OSDK APIs
|
|
18
|
+
|
|
19
|
+
// Environment
|
|
20
|
+
|
|
21
|
+
export let AliasEnvironment = /*#__PURE__*/function (AliasEnvironment) {
|
|
22
|
+
AliasEnvironment["PUBLISHED"] = "PUBLISHED";
|
|
23
|
+
AliasEnvironment["LIVE_PREVIEW"] = "LIVE_PREVIEW";
|
|
24
|
+
return AliasEnvironment;
|
|
25
|
+
}({});
|
|
26
|
+
|
|
27
|
+
// Live preview mode types (resources.json)
|
|
28
|
+
|
|
29
|
+
// Published mode types (aliases.json)
|
|
30
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":["AliasEnvironment"],"sources":["types.ts"],"sourcesContent":["/*\n * Copyright 2026 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\n// Types relevant to OSDK APIs\n\nexport type Custom = string & { readonly __brand: \"Custom\" };\n\nexport interface Model {\n rid: string;\n}\n\nexport interface ResolvedAliases {\n custom: Record<string, string>;\n models: Record<string, Model>;\n}\n\n// Environment\n\nexport enum AliasEnvironment {\n PUBLISHED = \"PUBLISHED\",\n LIVE_PREVIEW = \"LIVE_PREVIEW\",\n}\n\n// Live preview mode types (resources.json)\n\nexport interface ModelResource {\n identifier: ModelIdentifier;\n verbs: string[];\n alias?: string | null;\n}\n\nexport interface ResourceScopes {\n custom: Record<string, string>;\n models: ModelResource[];\n}\n\nexport interface ResourcesFile {\n resources: ResourceScopes;\n}\n\n// Published mode types (aliases.json)\n\nexport interface ModelIdentifier {\n rid: string;\n}\n\nexport interface ModelValue {\n id: ModelIdentifier;\n}\n\nexport interface DefaultAliases {\n custom: Record<string, string>;\n models: Record<string, ModelValue>;\n}\n\nexport interface AliasesFile {\n defaults: DefaultAliases;\n version: number;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAaA;;AAEA,WAAYA,gBAAgB,0BAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAA,OAAhBA,gBAAgB;AAAA;;AAK5B;;AAiBA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditBatch.js","names":[],"sources":["EditBatch.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n CompileTimeMetadata,\n InterfaceDefinition,\n ObjectTypeDefinition,\n} from \"@osdk/client\";\nimport type {\n AddLink,\n AnyEdit,\n CreateObject,\n CreateObjectForInterface,\n DeleteObject,\n DeleteObjectForInterface,\n InterfaceLocator,\n ObjectLocator,\n RemoveLink,\n UpdateObject,\n UpdateObjectForInterface,\n} from \"./types.js\";\n\n// Helper type for literal \"apiName\" values without resorting to expensive type inference.\ninterface ObjectTypeDefinitionForLocator<OL extends ObjectLocator<any>>\n extends ObjectTypeDefinition\n{\n apiName: OL[\"$apiName\"];\n}\n\ninterface InterfaceDefinitionForLocator<IL extends ObjectLocator<any>>\n extends InterfaceDefinition\n{\n apiName: IL[\"$apiName\"];\n}\n\n// AddLink helper types\nexport type AddLinkSources<X extends AnyEdit> = X extends\n AddLink<infer OTD, any> ? ObjectLocator<OTD> : never;\n\nexport type AddLinkApiNames<X extends AnyEdit, SOL extends ObjectLocator<any>> =\n X extends AddLink<ObjectTypeDefinitionForLocator<SOL>, infer A> ? A : never;\n\nexport type AddLinkTargets<\n X extends AnyEdit,\n SOL extends ObjectLocator<any>,\n A extends string,\n> = X extends AddLink<ObjectTypeDefinitionForLocator<SOL>, A>\n ? (X extends AddLink<infer OTD, A>\n ? (CompileTimeMetadata<OTD>[\"links\"][A][\"multiplicity\"] extends true\n ? Array<X[\"target\"]> | X[\"target\"]\n :
|
|
1
|
+
{"version":3,"file":"EditBatch.js","names":[],"sources":["EditBatch.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n CompileTimeMetadata,\n InterfaceDefinition,\n ObjectTypeDefinition,\n} from \"@osdk/client\";\nimport type {\n AddLink,\n AnyEdit,\n CreateObject,\n CreateObjectForInterface,\n DeleteObject,\n DeleteObjectForInterface,\n InterfaceLocator,\n ObjectLocator,\n RemoveLink,\n UpdateObject,\n UpdateObjectForInterface,\n} from \"./types.js\";\n\n// Helper type for literal \"apiName\" values without resorting to expensive type inference.\ninterface ObjectTypeDefinitionForLocator<OL extends ObjectLocator<any>>\n extends ObjectTypeDefinition\n{\n apiName: OL[\"$apiName\"];\n}\n\ninterface InterfaceDefinitionForLocator<IL extends ObjectLocator<any>>\n extends InterfaceDefinition\n{\n apiName: IL[\"$apiName\"];\n}\n\n// AddLink helper types\nexport type AddLinkSources<X extends AnyEdit> = X extends\n AddLink<infer OTD, any> ? ObjectLocator<OTD> : never;\n\nexport type AddLinkApiNames<X extends AnyEdit, SOL extends ObjectLocator<any>> =\n X extends AddLink<ObjectTypeDefinitionForLocator<SOL>, infer A> ? A : never;\n\nexport type AddLinkTargets<\n X extends AnyEdit,\n SOL extends ObjectLocator<any>,\n A extends string,\n> = X extends AddLink<ObjectTypeDefinitionForLocator<SOL>, A>\n ? (X extends AddLink<infer OTD, A>\n ? (CompileTimeMetadata<OTD>[\"links\"][A][\"multiplicity\"] extends true\n ? Array<X[\"target\"]> | X[\"target\"]\n : X[\"target\"])\n : never)\n : never;\n\n// RemoveLink helper types\nexport type RemoveLinkSources<X extends AnyEdit> = X extends\n RemoveLink<infer OTD, any> ? ObjectLocator<OTD> : never;\n\nexport type RemoveLinkApiNames<\n X extends AnyEdit,\n SOL extends ObjectLocator<any>,\n> = X extends RemoveLink<ObjectTypeDefinitionForLocator<SOL>, infer L> ? L\n : never;\n\nexport type RemoveLinkTargets<\n X extends AnyEdit,\n SOL extends ObjectLocator<any>,\n A extends string,\n> = X extends RemoveLink<ObjectTypeDefinitionForLocator<SOL>, A>\n ? (X extends RemoveLink<infer OTD, A>\n ? (CompileTimeMetadata<OTD>[\"links\"][A][\"multiplicity\"] extends true\n ? Array<X[\"target\"]> | X[\"target\"]\n : X[\"target\"])\n : never)\n : never;\n\n// CreateObject helper types\nexport type CreatableObjectOrInterfaceTypes<X extends AnyEdit> = X extends\n CreateObject<infer OTD> ? OTD\n : X extends CreateObjectForInterface<infer ID> ? ID\n : never;\n\nexport type CreatableObjectOrInterfaceTypeProperties<\n X extends AnyEdit,\n OI extends ObjectTypeDefinition | InterfaceDefinition,\n> = X extends CreateObject<infer OTD> ? OTD extends OI ? X[\"properties\"] : never\n : X extends CreateObjectForInterface<infer ID>\n ? ID extends OI ? X[\"properties\"] : never\n : never;\n\n// DeleteObject helper types\nexport type DeletableObjectOrInterfaceLocators<X extends AnyEdit> = X extends\n DeleteObject<infer OTD> ? ObjectLocator<OTD>\n : X extends DeleteObjectForInterface<infer ID> ? InterfaceLocator<ID>\n : never;\n\n// UpdateObject and UpdateInterface helper types\nexport type UpdatableObjectOrInterfaceLocators<X extends AnyEdit> = X extends\n UpdateObject<infer OTD> ? ObjectLocator<OTD>\n : X extends UpdateObjectForInterface<infer ID> ? InterfaceLocator<ID>\n : never;\n\nexport type UpdatableObjectOrInterfaceLocatorProperties<\n X extends AnyEdit,\n OL extends ObjectLocator<any>,\n> = X extends UpdateObject<ObjectTypeDefinitionForLocator<OL>> ? X[\"properties\"]\n : X extends UpdateObjectForInterface<InterfaceDefinitionForLocator<OL>>\n ? X[\"properties\"]\n : never;\n\nexport interface EditBatch<\n X extends AnyEdit = never,\n> {\n link: <\n SOL extends AddLinkSources<X>,\n A extends AddLinkApiNames<X, SOL>,\n >(\n source: SOL,\n apiName: A,\n target: AddLinkTargets<X, SOL, A>,\n ) => void;\n\n unlink: <\n SOL extends RemoveLinkSources<X>,\n A extends RemoveLinkApiNames<X, SOL>,\n >(\n source: SOL,\n apiName: A,\n target: RemoveLinkTargets<X, SOL, A>,\n ) => void;\n\n create: <OI extends CreatableObjectOrInterfaceTypes<X>>(\n objectOrInterfaceType: OI,\n properties: CreatableObjectOrInterfaceTypeProperties<X, OI>,\n ) => void;\n\n delete: <OL extends DeletableObjectOrInterfaceLocators<X>>(obj: OL) => void;\n\n update: <OL extends UpdatableObjectOrInterfaceLocators<X>>(\n obj: OL,\n properties: UpdatableObjectOrInterfaceLocatorProperties<X, OL>,\n ) => void;\n\n getEdits: () => X[];\n}\n"],"mappings":"","ignoreList":[]}
|
package/build/browser/index.js
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
export * as Aliases from "./aliases/index.js";
|
|
17
18
|
export { createEditBatch } from "./edits/createEditBatch.js";
|
|
18
19
|
export { UserFacingError } from "./errors/UserFacingError.js";
|
|
19
20
|
export { uploadMedia } from "./helpers/uploadMedia.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["createEditBatch","UserFacingError","uploadMedia"],"sources":["index.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type {\n DateISOString,\n Double,\n Float,\n Integer,\n Long,\n TimestampISOString,\n} from \"./PrimitiveTypes.js\";\n\nexport type {\n Attachment,\n MediaReference,\n MediaUpload,\n Range,\n ThreeDimensionalAggregation,\n TwoDimensionalAggregation,\n} from \"@osdk/client\";\n\nexport { createEditBatch } from \"./edits/createEditBatch.js\";\nexport type { EditBatch } from \"./edits/EditBatch.js\";\nexport type { Edits } from \"./edits/types.js\";\nexport { UserFacingError } from \"./errors/UserFacingError.js\";\nexport { uploadMedia } from \"./helpers/uploadMedia.js\";\n\nexport type {\n EmailNotification,\n Notification,\n NotificationLink,\n NotificationLinkTarget,\n ObjectLinkTarget,\n PlatformNotification,\n RidLinkTarget,\n UrlLinkTarget,\n} from \"./Notification.js\";\n\nexport type { ClassificationMarking, MandatoryMarking } from \"./Markings.js\";\nexport type { GroupId, Principal, UserId } from \"./UserGroup.js\";\n\nexport type { Geometry, Point } from \"geojson\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAoBA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["Aliases","createEditBatch","UserFacingError","uploadMedia"],"sources":["index.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type {\n DateISOString,\n Double,\n Float,\n Integer,\n Long,\n TimestampISOString,\n} from \"./PrimitiveTypes.js\";\n\nexport type {\n Attachment,\n MediaReference,\n MediaUpload,\n Range,\n ThreeDimensionalAggregation,\n TwoDimensionalAggregation,\n} from \"@osdk/client\";\n\nexport * as Aliases from \"./aliases/index.js\";\nexport { createEditBatch } from \"./edits/createEditBatch.js\";\nexport type { EditBatch } from \"./edits/EditBatch.js\";\nexport type { Edits } from \"./edits/types.js\";\nexport { UserFacingError } from \"./errors/UserFacingError.js\";\nexport { uploadMedia } from \"./helpers/uploadMedia.js\";\n\nexport type {\n EmailNotification,\n Notification,\n NotificationLink,\n NotificationLinkTarget,\n ObjectLinkTarget,\n PlatformNotification,\n RidLinkTarget,\n UrlLinkTarget,\n} from \"./Notification.js\";\n\nexport type { ClassificationMarking, MandatoryMarking } from \"./Markings.js\";\nexport type { GroupId, Principal, UserId } from \"./UserGroup.js\";\n\nexport type { Geometry, Point } from \"geojson\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAoBA,OAAO,KAAKA,OAAO,MAAM,oBAAoB;AAC7C,SAASC,eAAe,QAAQ,4BAA4B;AAG5D,SAASC,eAAe,QAAQ,6BAA6B;AAC7D,SAASC,WAAW,QAAQ,0BAA0B","ignoreList":[]}
|
|
@@ -9,10 +9,10 @@ interface InterfaceDefinitionForLocator<IL extends ObjectLocator<any>> extends I
|
|
|
9
9
|
}
|
|
10
10
|
type AddLinkSources<X extends AnyEdit> = X extends AddLink<infer OTD, any> ? ObjectLocator<OTD> : never;
|
|
11
11
|
type AddLinkApiNames<X extends AnyEdit, SOL extends ObjectLocator<any>> = X extends AddLink<ObjectTypeDefinitionForLocator<SOL>, infer A> ? A : never;
|
|
12
|
-
type AddLinkTargets<X extends AnyEdit, SOL extends ObjectLocator<any>, A extends string> = X extends AddLink<ObjectTypeDefinitionForLocator<SOL>, A> ? (X extends AddLink<infer OTD, A> ? (CompileTimeMetadata<OTD>["links"][A]["multiplicity"] extends true ? Array<X["target"]> | X["target"] :
|
|
12
|
+
type AddLinkTargets<X extends AnyEdit, SOL extends ObjectLocator<any>, A extends string> = X extends AddLink<ObjectTypeDefinitionForLocator<SOL>, A> ? (X extends AddLink<infer OTD, A> ? (CompileTimeMetadata<OTD>["links"][A]["multiplicity"] extends true ? Array<X["target"]> | X["target"] : X["target"]) : never) : never;
|
|
13
13
|
type RemoveLinkSources<X extends AnyEdit> = X extends RemoveLink<infer OTD, any> ? ObjectLocator<OTD> : never;
|
|
14
14
|
type RemoveLinkApiNames<X extends AnyEdit, SOL extends ObjectLocator<any>> = X extends RemoveLink<ObjectTypeDefinitionForLocator<SOL>, infer L> ? L : never;
|
|
15
|
-
type RemoveLinkTargets<X extends AnyEdit, SOL extends ObjectLocator<any>, A extends string> = X extends RemoveLink<ObjectTypeDefinitionForLocator<SOL>, A> ? (X extends RemoveLink<infer OTD, A> ? (CompileTimeMetadata<OTD>["links"][A]["multiplicity"] extends true ? Array<X["target"]> | X["target"] :
|
|
15
|
+
type RemoveLinkTargets<X extends AnyEdit, SOL extends ObjectLocator<any>, A extends string> = X extends RemoveLink<ObjectTypeDefinitionForLocator<SOL>, A> ? (X extends RemoveLink<infer OTD, A> ? (CompileTimeMetadata<OTD>["links"][A]["multiplicity"] extends true ? Array<X["target"]> | X["target"] : X["target"]) : never) : never;
|
|
16
16
|
type CreatableObjectOrInterfaceTypes<X extends AnyEdit> = X extends CreateObject<infer OTD> ? OTD : X extends CreateObjectForInterface<infer ID> ? ID : never;
|
|
17
17
|
type CreatableObjectOrInterfaceTypeProperties<X extends AnyEdit, OI extends ObjectTypeDefinition | InterfaceDefinition> = X extends CreateObject<infer OTD> ? OTD extends OI ? X["properties"] : never : X extends CreateObjectForInterface<infer ID> ? ID extends OI ? X["properties"] : never : never;
|
|
18
18
|
type DeletableObjectOrInterfaceLocators<X extends AnyEdit> = X extends DeleteObject<infer OTD> ? ObjectLocator<OTD> : X extends DeleteObjectForInterface<infer ID> ? InterfaceLocator<ID> : never;
|
package/build/cjs/index.cjs
CHANGED
|
@@ -1,6 +1,138 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunk4DCWE2WY_cjs = require('./chunk-4DCWE2WY.cjs');
|
|
4
|
+
var fs = require('fs');
|
|
5
|
+
|
|
6
|
+
function _interopNamespace(e) {
|
|
7
|
+
if (e && e.__esModule) return e;
|
|
8
|
+
var n = Object.create(null);
|
|
9
|
+
if (e) {
|
|
10
|
+
Object.keys(e).forEach(function (k) {
|
|
11
|
+
if (k !== 'default') {
|
|
12
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
13
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return e[k]; }
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
n.default = e;
|
|
21
|
+
return Object.freeze(n);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
|
|
25
|
+
|
|
26
|
+
// src/aliases/index.ts
|
|
27
|
+
var aliases_exports = {};
|
|
28
|
+
chunk4DCWE2WY_cjs.__export(aliases_exports, {
|
|
29
|
+
custom: () => custom,
|
|
30
|
+
model: () => model
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// src/aliases/types.ts
|
|
34
|
+
var AliasEnvironment = /* @__PURE__ */ (function(AliasEnvironment2) {
|
|
35
|
+
AliasEnvironment2["PUBLISHED"] = "PUBLISHED";
|
|
36
|
+
AliasEnvironment2["LIVE_PREVIEW"] = "LIVE_PREVIEW";
|
|
37
|
+
return AliasEnvironment2;
|
|
38
|
+
})({});
|
|
39
|
+
|
|
40
|
+
// src/aliases/environment.ts
|
|
41
|
+
var ALIASES_JSON_FILE_ENV_VAR = "ALIASES_JSON_FILE";
|
|
42
|
+
var RESOURCES_JSON_FILE_ENV_VAR = "RESOURCES_JSON_FILE";
|
|
43
|
+
function detectEnvironment() {
|
|
44
|
+
const aliasesFileSet = ALIASES_JSON_FILE_ENV_VAR in process.env;
|
|
45
|
+
const resourcesFileSet = RESOURCES_JSON_FILE_ENV_VAR in process.env;
|
|
46
|
+
if (aliasesFileSet && resourcesFileSet) {
|
|
47
|
+
throw new Error(`Ambiguous alias configuration: both ${ALIASES_JSON_FILE_ENV_VAR} and ${RESOURCES_JSON_FILE_ENV_VAR} are set. Only one should be configured.`);
|
|
48
|
+
}
|
|
49
|
+
if (aliasesFileSet) {
|
|
50
|
+
return AliasEnvironment.PUBLISHED;
|
|
51
|
+
}
|
|
52
|
+
if (resourcesFileSet) {
|
|
53
|
+
return AliasEnvironment.LIVE_PREVIEW;
|
|
54
|
+
}
|
|
55
|
+
throw new Error(`Unknown alias environment: neither ${ALIASES_JSON_FILE_ENV_VAR} nor ${RESOURCES_JSON_FILE_ENV_VAR} is set.`);
|
|
56
|
+
}
|
|
57
|
+
function getAliasesFilePath() {
|
|
58
|
+
const path = process.env[ALIASES_JSON_FILE_ENV_VAR];
|
|
59
|
+
if (path == null) {
|
|
60
|
+
throw new Error(`${ALIASES_JSON_FILE_ENV_VAR} environment variable is not set`);
|
|
61
|
+
}
|
|
62
|
+
return path;
|
|
63
|
+
}
|
|
64
|
+
function getResourcesFilePath() {
|
|
65
|
+
const path = process.env[RESOURCES_JSON_FILE_ENV_VAR];
|
|
66
|
+
if (path == null) {
|
|
67
|
+
throw new Error(`${RESOURCES_JSON_FILE_ENV_VAR} environment variable is not set`);
|
|
68
|
+
}
|
|
69
|
+
return path;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// src/aliases/loaders.ts
|
|
73
|
+
var cachedPublishedAliases;
|
|
74
|
+
function loadPublishedAliases() {
|
|
75
|
+
if (cachedPublishedAliases !== void 0) {
|
|
76
|
+
return cachedPublishedAliases;
|
|
77
|
+
}
|
|
78
|
+
const aliasesPath = getAliasesFilePath();
|
|
79
|
+
if (!fs__namespace.existsSync(aliasesPath)) {
|
|
80
|
+
throw new Error(`Aliases file not found at ${aliasesPath}`);
|
|
81
|
+
}
|
|
82
|
+
const data = fs__namespace.readFileSync(aliasesPath, "utf-8");
|
|
83
|
+
const aliasesFile = JSON.parse(data);
|
|
84
|
+
cachedPublishedAliases = {
|
|
85
|
+
custom: aliasesFile.defaults.custom,
|
|
86
|
+
models: Object.fromEntries(Object.entries(aliasesFile.defaults.models).map(([alias, {
|
|
87
|
+
id: identifier
|
|
88
|
+
}]) => [alias, identifier]))
|
|
89
|
+
};
|
|
90
|
+
return cachedPublishedAliases;
|
|
91
|
+
}
|
|
92
|
+
function loadPreviewAliases() {
|
|
93
|
+
const resourcesPath = getResourcesFilePath();
|
|
94
|
+
if (!fs__namespace.existsSync(resourcesPath)) {
|
|
95
|
+
throw new Error(`Resources file not found at ${resourcesPath}`);
|
|
96
|
+
}
|
|
97
|
+
const data = fs__namespace.readFileSync(resourcesPath, "utf-8");
|
|
98
|
+
const resourcesFile = JSON.parse(data);
|
|
99
|
+
return {
|
|
100
|
+
custom: resourcesFile.resources.custom,
|
|
101
|
+
models: Object.fromEntries(resourcesFile.resources.models.filter((model2) => model2.alias != null).map(({
|
|
102
|
+
alias,
|
|
103
|
+
identifier
|
|
104
|
+
}) => [alias, identifier]))
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function loadResolvedAliases() {
|
|
108
|
+
const environment = detectEnvironment();
|
|
109
|
+
switch (environment) {
|
|
110
|
+
case AliasEnvironment.PUBLISHED:
|
|
111
|
+
return loadPublishedAliases();
|
|
112
|
+
case AliasEnvironment.LIVE_PREVIEW:
|
|
113
|
+
return loadPreviewAliases();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// src/aliases/custom.ts
|
|
118
|
+
function custom(alias) {
|
|
119
|
+
const resolvedAliases = loadResolvedAliases();
|
|
120
|
+
if (!(alias in resolvedAliases.custom)) {
|
|
121
|
+
const available = Object.keys(resolvedAliases.custom);
|
|
122
|
+
throw new Error(`Custom alias '${alias}' not found. Available aliases: [${available.join(", ")}]`);
|
|
123
|
+
}
|
|
124
|
+
return resolvedAliases.custom[alias];
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// src/aliases/model.ts
|
|
128
|
+
function model(alias) {
|
|
129
|
+
const resolvedAliases = loadResolvedAliases();
|
|
130
|
+
if (!(alias in resolvedAliases.models)) {
|
|
131
|
+
const available = Object.keys(resolvedAliases.models);
|
|
132
|
+
throw new Error(`Model alias '${alias}' not found. Available aliases: [${available.join(", ")}]`);
|
|
133
|
+
}
|
|
134
|
+
return resolvedAliases.models[alias];
|
|
135
|
+
}
|
|
4
136
|
|
|
5
137
|
// src/edits/types.ts
|
|
6
138
|
function isInterfaceLocator(obj) {
|
|
@@ -192,6 +324,7 @@ async function uploadMedia2(client, mediaUpload) {
|
|
|
192
324
|
};
|
|
193
325
|
}
|
|
194
326
|
|
|
327
|
+
exports.Aliases = aliases_exports;
|
|
195
328
|
exports.UserFacingError = UserFacingError;
|
|
196
329
|
exports.createEditBatch = createEditBatch;
|
|
197
330
|
exports.uploadMedia = uploadMedia2;
|
package/build/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/edits/types.ts","../../src/edits/createEditBatch.ts","../../src/errors/UserFacingError.ts","../../../../node_modules/.pnpm/@osdk+foundry.mediasets@2.44.0/node_modules/@osdk/foundry.mediasets/build/esm/public/MediaSet.js","../../src/helpers/uploadMedia.ts"],"names":["__export","foundryPlatformFetch","uploadMedia"],"mappings":";;;;;AAmBO,SAAS,mBAAmB,GAAK,EAAA;AACtC,EAAA,OAAO,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ved.\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 let Edits;\n// Check if locator is for an interface by comparing $apiName and $objectType.\n// Both object types and interfaces store the object type API name in $objectType,\n// but interfaces store the interface API name in $apiName.\nexport function isInterfaceLocator(obj) {\n return obj != null && typeof obj === \"object\" && typeof obj.$objectType === \"string\" && typeof obj.$apiName === \"string\" && obj.$apiName !== obj.$objectType;\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { isInterfaceLocator } from \"./types.js\";\nclass InMemoryEditBatch {\n edits = [];\n link(source, apiName, target) {\n if (!Array.isArray(target)) {\n this.edits.push({\n type: \"addLink\",\n source,\n apiName,\n target\n });\n return;\n }\n for (const elem of target) {\n this.edits.push({\n type: \"addLink\",\n source,\n apiName,\n target: elem\n });\n }\n }\n unlink(source, apiName, target) {\n if (!Array.isArray(target)) {\n this.edits.push({\n type: \"removeLink\",\n source,\n apiName,\n target\n });\n return;\n }\n for (const elem of target) {\n this.edits.push({\n type: \"removeLink\",\n source,\n apiName,\n target: elem\n });\n }\n }\n create(objectOrInterfaceType, properties) {\n if (objectOrInterfaceType.type === \"interface\") {\n this.edits.push({\n type: \"createObjectForInterface\",\n int: objectOrInterfaceType,\n properties\n });\n return;\n }\n this.edits.push({\n type: \"createObject\",\n obj: objectOrInterfaceType,\n properties\n });\n }\n delete(obj) {\n if (isInterfaceLocator(obj)) {\n this.edits.push({\n type: \"deleteObjectForInterface\",\n obj\n });\n return;\n }\n this.edits.push({\n type: \"deleteObject\",\n obj\n });\n }\n update(obj, properties) {\n if (isInterfaceLocator(obj)) {\n this.edits.push({\n type: \"updateObjectForInterface\",\n obj,\n properties\n });\n return;\n }\n this.edits.push({\n type: \"updateObject\",\n obj,\n properties\n });\n }\n getEdits() {\n return [...this.edits];\n }\n}\nexport function createEditBatch(_client) {\n return new InMemoryEditBatch();\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport class UserFacingError extends Error {\n constructor(message) {\n super(message);\n }\n}","/*\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 { foundryPlatformFetch as $foundryPlatformFetch } from \"@osdk/shared.net.platformapi\";\n//\nconst _abort = [1, \"/v2/mediasets/{0}/transactions/{1}/abort\", 2];\n/**\n * Aborts an open transaction. Items uploaded to the media set during this transaction will be deleted.\n *\n * @beta\n *\n * Required Scopes: [api:mediasets-write]\n * URL: /v2/mediasets/{mediaSetRid}/transactions/{transactionId}/abort\n */\nexport function abort($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _abort, ...args);\n}\nconst _calculate = [0, \"/v2/mediasets/{0}/items/{1}/transform/imagery/thumbnail/calculate\", 6];\n/**\n * Starts calculation of a thumbnail for a given image.\n *\n * @alpha\n *\n * Required Scopes: [api:mediasets-read]\n * URL: /v2/mediasets/{mediaSetRid}/items/{mediaItemRid}/transform/imagery/thumbnail/calculate\n */\nexport function calculate($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _calculate, ...args);\n}\nconst _commit = [1, \"/v2/mediasets/{0}/transactions/{1}/commit\", 2];\n/**\n * Commits an open transaction. On success, items uploaded to the media set during this transaction will become available.\n *\n * @beta\n *\n * Required Scopes: [api:mediasets-write]\n * URL: /v2/mediasets/{mediaSetRid}/transactions/{transactionId}/commit\n */\nexport function commit($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _commit, ...args);\n}\nconst _create = [1, \"/v2/mediasets/{0}/transactions\", 2];\n/**\n * Creates a new transaction. Items uploaded to the media set while this transaction is open will not be reflected until the transaction is committed.\n *\n * @beta\n *\n * Required Scopes: [api:mediasets-write]\n * URL: /v2/mediasets/{mediaSetRid}/transactions\n */\nexport function create($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _create, ...args);\n}\nconst _info = [0, \"/v2/mediasets/{0}/items/{1}\", 6];\n/**\n * Gets information about the media item.\n *\n * @beta\n *\n * Required Scopes: [api:mediasets-read]\n * URL: /v2/mediasets/{mediaSetRid}/items/{mediaItemRid}\n */\nexport function info($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _info, ...args);\n}\nconst _reference = [0, \"/v2/mediasets/{0}/items/{1}/reference\", 6];\n/**\n * Gets the [media reference](https://www.palantir.com/docs/foundry/data-integration/media-sets/#media-references) for this media item.\n *\n * @beta\n *\n * Required Scopes: [api:mediasets-read]\n * URL: /v2/mediasets/{mediaSetRid}/items/{mediaItemRid}/reference\n */\nexport function reference($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _reference, ...args);\n}\nconst _getRidByPath = [0, \"/v2/mediasets/{0}/items/getRidByPath\", 2];\n/**\n * Returns the media item RID for the media item with the specified path.\n *\n * @beta\n *\n * Required Scopes: [api:mediasets-read]\n * URL: /v2/mediasets/{mediaSetRid}/items/getRidByPath\n */\nexport function getRidByPath($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _getRidByPath, ...args);\n}\nconst _upload = [1, \"/v2/mediasets/{0}/items\", 3, \"*/*\"];\n/**\n * Uploads a media item to an existing media set.\n * The body of the request must contain the binary content of the file and the `Content-Type` header must be `application/octet-stream`.\n * A branch name, or branch rid, or view rid may optionally be specified. If none is specified, the item will be uploaded to the default branch. If more than one is specified, an error is thrown.\n *\n * @beta\n *\n * Required Scopes: [api:mediasets-write]\n * URL: /v2/mediasets/{mediaSetRid}/items\n */\nexport function upload($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _upload, ...args);\n}\nconst _read = [0, \"/v2/mediasets/{0}/items/{1}/content\", 6,, \"*/*\"];\n/**\n * Gets the content of a media item.\n *\n * @beta\n *\n * Required Scopes: [api:mediasets-read]\n * URL: /v2/mediasets/{mediaSetRid}/items/{mediaItemRid}/content\n */\nexport function read($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _read, ...args);\n}\nconst _readOriginal = [0, \"/v2/mediasets/{0}/items/{1}/original\", 6,, \"*/*\"];\n/**\n * Gets the content of an original file uploaded to the media item, even if it was transformed on upload due to being an additional input format.\n *\n * @beta\n *\n * Required Scopes: [api:mediasets-read]\n * URL: /v2/mediasets/{mediaSetRid}/items/{mediaItemRid}/original\n */\nexport function readOriginal($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _readOriginal, ...args);\n}\nconst _retrieve = [0, \"/v2/mediasets/{0}/items/{1}/transform/imagery/thumbnail/retrieve\", 6,, \"*/*\"];\n/**\n * Retrieves a successfully calculated thumbnail for a given image.\n *\n * Thumbnails are 200px wide in the format of `image/webp`\n *\n * @alpha\n *\n * Required Scopes: [api:mediasets-read]\n * URL: /v2/mediasets/{mediaSetRid}/items/{mediaItemRid}/transform/imagery/thumbnail/retrieve\n */\nexport function retrieve($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _retrieve, ...args);\n}\nconst _uploadMedia = [2, \"/v2/mediasets/media/upload\", 7, \"*/*\"];\n/**\n * Uploads a temporary media item. If the media item isn't persisted within 1 hour, the item will be deleted.\n *\n * If multiple resources are attributed to, usage will be attributed to the first one in the list.\n *\n * The body of the request must contain the binary content of the file and the `Content-Type` header must be `application/octet-stream`.\n * Third-party applications using this endpoint via OAuth2 must request the following operation scopes: `api:ontologies-read api:ontologies-write`.\n *\n * @beta\n *\n * Required Scopes: [api:ontologies-read, api:ontologies-write]\n * URL: /v2/mediasets/media/upload\n */\nexport function uploadMedia($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _uploadMedia, ...args);\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MediaSets } from \"@osdk/foundry.mediasets\";\nexport async function uploadMedia(client, mediaUpload) {\n const gatewayMediaRef = await MediaSets.uploadMedia(client, mediaUpload.data, {\n filename: mediaUpload.fileName,\n preview: true\n });\n return {\n mimeType: gatewayMediaRef.mimeType,\n reference: {\n type: \"mediaSetViewItem\",\n mediaSetViewItem: {\n mediaItemRid: gatewayMediaRef.reference.mediaSetViewItem.mediaItemRid,\n mediaSetRid: gatewayMediaRef.reference.mediaSetViewItem.mediaSetRid,\n mediaSetViewRid: gatewayMediaRef.reference.mediaSetViewItem.mediaSetViewRid,\n token: gatewayMediaRef.reference.mediaSetViewItem.token,\n readToken: gatewayMediaRef.reference.mediaSetViewItem.token\n }\n }\n };\n}"]}
|
|
1
|
+
{"version":3,"sources":["../../src/aliases/index.ts","../../src/aliases/types.ts","../../src/aliases/environment.ts","../../src/aliases/loaders.ts","../../src/aliases/custom.ts","../../src/aliases/model.ts","../../src/edits/types.ts","../../src/edits/createEditBatch.ts","../../src/errors/UserFacingError.ts","../../../../node_modules/.pnpm/@osdk+foundry.mediasets@2.44.0/node_modules/@osdk/foundry.mediasets/build/esm/public/MediaSet.js","../../src/helpers/uploadMedia.ts"],"names":["__export","AliasEnvironment","fs","model","foundryPlatformFetch","uploadMedia"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,eAAA,GAAA;AAAAA,0BAAA,CAAA,eAAA,EAAA;AAAA,EAAA,MAAA,EAAA,MAAA,MAAA;AAAA,EAAA,KAAA,EAAA,MAAA;AAAA,CAAA,CAAA;;;ACoBO,IAAI,gBAAA,6BAA0CC,iBAAkB,EAAA;AACrE,EAAAA,iBAAAA,CAAiB,WAAW,CAAI,GAAA,WAAA;AAChC,EAAAA,iBAAAA,CAAiB,cAAc,CAAI,GAAA,cAAA;AACnC,EAAOA,OAAAA,iBAAAA;AACT,CAAA,EAAE,EAAE,CAAA;;;ACPG,IAAM,yBAA4B,GAAA,mBAAA;AAClC,IAAM,2BAA8B,GAAA,qBAAA;AACpC,SAAS,iBAAoB,GAAA;AAClC,EAAM,MAAA,cAAA,GAAiB,6BAA6B,OAAQ,CAAA,GAAA;AAC5D,EAAM,MAAA,gBAAA,GAAmB,+BAA+B,OAAQ,CAAA,GAAA;AAChE,EAAA,IAAI,kBAAkB,gBAAkB,EAAA;AACtC,IAAA,MAAM,IAAI,KAAM,CAAA,CAAA,oCAAA,EAAuC,yBAAyB,CAAA,KAAA,EAAa,2BAA2B,CAA0C,wCAAA,CAAA,CAAA;AAAA;AAEpK,EAAA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,4BAAA,EAA8B,GAAG,KAAK,CAAA;AAcxD,SAAS,WAAA,CAAY,SAAS,IAAM,EAAA;AACzC,EAAA,OAAOA,sCAAsB,CAAA,IAAA,EAAM,YAAc,EAAA,GAAG,IAAI,CAAA;AAC1D;;;ACxJA,eAAsBC,YAAAA,CAAY,QAAQ,WAAa,EAAA;AACrD,EAAA,MAAM,kBAAkB,MAAM,gBAAA,CAAU,WAAY,CAAA,MAAA,EAAQ,YAAY,IAAM,EAAA;AAAA,IAC5E,UAAU,WAAY,CAAA,QAAA;AAAA,IACtB,OAAS,EAAA;AAAA,GACV,CAAA;AACD,EAAO,OAAA;AAAA,IACL,UAAU,eAAgB,CAAA,QAAA;AAAA,IAC1B,SAAW,EAAA;AAAA,MACT,IAAM,EAAA,kBAAA;AAAA,MACN,gBAAkB,EAAA;AAAA,QAChB,YAAA,EAAc,eAAgB,CAAA,SAAA,CAAU,gBAAiB,CAAA,YAAA;AAAA,QACzD,WAAA,EAAa,eAAgB,CAAA,SAAA,CAAU,gBAAiB,CAAA,WAAA;AAAA,QACxD,eAAA,EAAiB,eAAgB,CAAA,SAAA,CAAU,gBAAiB,CAAA,eAAA;AAAA,QAC5D,KAAA,EAAO,eAAgB,CAAA,SAAA,CAAU,gBAAiB,CAAA,KAAA;AAAA,QAClD,SAAA,EAAW,eAAgB,CAAA,SAAA,CAAU,gBAAiB,CAAA;AAAA;AACxD;AACF,GACF;AACF","file":"index.cjs","sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from \"./custom.js\";\nexport * from \"./model.js\";","/*\n * Copyright 2026 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\n// Types relevant to OSDK APIs\n\n// Environment\n\nexport let AliasEnvironment = /*#__PURE__*/function (AliasEnvironment) {\n AliasEnvironment[\"PUBLISHED\"] = \"PUBLISHED\";\n AliasEnvironment[\"LIVE_PREVIEW\"] = \"LIVE_PREVIEW\";\n return AliasEnvironment;\n}({});\n\n// Live preview mode types (resources.json)\n\n// Published mode types (aliases.json)","/*\n * Copyright 2026 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 { AliasEnvironment } from \"./types.js\";\nexport const ALIASES_JSON_FILE_ENV_VAR = \"ALIASES_JSON_FILE\";\nexport const RESOURCES_JSON_FILE_ENV_VAR = \"RESOURCES_JSON_FILE\";\nexport function detectEnvironment() {\n const aliasesFileSet = ALIASES_JSON_FILE_ENV_VAR in process.env;\n const resourcesFileSet = RESOURCES_JSON_FILE_ENV_VAR in process.env;\n if (aliasesFileSet && resourcesFileSet) {\n throw new Error(`Ambiguous alias configuration: both ${ALIASES_JSON_FILE_ENV_VAR} and ` + `${RESOURCES_JSON_FILE_ENV_VAR} are set. Only one should be configured.`);\n }\n if (aliasesFileSet) {\n return AliasEnvironment.PUBLISHED;\n }\n if (resourcesFileSet) {\n return AliasEnvironment.LIVE_PREVIEW;\n }\n throw new Error(`Unknown alias environment: neither ${ALIASES_JSON_FILE_ENV_VAR} nor ${RESOURCES_JSON_FILE_ENV_VAR} is set.`);\n}\nexport function getAliasesFilePath() {\n const path = process.env[ALIASES_JSON_FILE_ENV_VAR];\n if (path == null) {\n throw new Error(`${ALIASES_JSON_FILE_ENV_VAR} environment variable is not set`);\n }\n return path;\n}\nexport function getResourcesFilePath() {\n const path = process.env[RESOURCES_JSON_FILE_ENV_VAR];\n if (path == null) {\n throw new Error(`${RESOURCES_JSON_FILE_ENV_VAR} environment variable is not set`);\n }\n return path;\n}","/*\n * Copyright 2026 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 * as fs from \"fs\";\nimport { detectEnvironment, getAliasesFilePath, getResourcesFilePath } from \"./environment.js\";\nimport { AliasEnvironment } from \"./types.js\";\nlet cachedPublishedAliases;\nfunction loadPublishedAliases() {\n if (cachedPublishedAliases !== undefined) {\n return cachedPublishedAliases;\n }\n const aliasesPath = getAliasesFilePath();\n if (!fs.existsSync(aliasesPath)) {\n throw new Error(`Aliases file not found at ${aliasesPath}`);\n }\n const data = fs.readFileSync(aliasesPath, \"utf-8\");\n const aliasesFile = JSON.parse(data);\n cachedPublishedAliases = {\n custom: aliasesFile.defaults.custom,\n models: Object.fromEntries(Object.entries(aliasesFile.defaults.models).map(([alias, {\n id: identifier\n }]) => [alias, identifier]))\n };\n return cachedPublishedAliases;\n}\nfunction loadPreviewAliases() {\n const resourcesPath = getResourcesFilePath();\n if (!fs.existsSync(resourcesPath)) {\n throw new Error(`Resources file not found at ${resourcesPath}`);\n }\n const data = fs.readFileSync(resourcesPath, \"utf-8\");\n const resourcesFile = JSON.parse(data);\n return {\n custom: resourcesFile.resources.custom,\n models: Object.fromEntries(resourcesFile.resources.models.filter(model => model.alias != null).map(({\n alias,\n identifier\n }) => [alias, identifier]))\n };\n}\nexport function resetPublishedCache() {\n cachedPublishedAliases = undefined;\n}\nexport function loadResolvedAliases() {\n const environment = detectEnvironment();\n switch (environment) {\n case AliasEnvironment.PUBLISHED:\n return loadPublishedAliases();\n case AliasEnvironment.LIVE_PREVIEW:\n return loadPreviewAliases();\n }\n}","/*\n * Copyright 2026 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 { loadResolvedAliases } from \"./loaders.js\";\nexport function custom(alias) {\n const resolvedAliases = loadResolvedAliases();\n if (!(alias in resolvedAliases.custom)) {\n const available = Object.keys(resolvedAliases.custom);\n throw new Error(`Custom alias '${alias}' not found. Available aliases: [${available.join(\", \")}]`);\n }\n return resolvedAliases.custom[alias];\n}","/*\n * Copyright 2026 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 { loadResolvedAliases } from \"./loaders.js\";\nexport function model(alias) {\n const resolvedAliases = loadResolvedAliases();\n if (!(alias in resolvedAliases.models)) {\n const available = Object.keys(resolvedAliases.models);\n throw new Error(`Model alias '${alias}' not found. Available aliases: [${available.join(\", \")}]`);\n }\n return resolvedAliases.models[alias];\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport let Edits;\n// Check if locator is for an interface by comparing $apiName and $objectType.\n// Both object types and interfaces store the object type API name in $objectType,\n// but interfaces store the interface API name in $apiName.\nexport function isInterfaceLocator(obj) {\n return obj != null && typeof obj === \"object\" && typeof obj.$objectType === \"string\" && typeof obj.$apiName === \"string\" && obj.$apiName !== obj.$objectType;\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { isInterfaceLocator } from \"./types.js\";\nclass InMemoryEditBatch {\n edits = [];\n link(source, apiName, target) {\n if (!Array.isArray(target)) {\n this.edits.push({\n type: \"addLink\",\n source,\n apiName,\n target\n });\n return;\n }\n for (const elem of target) {\n this.edits.push({\n type: \"addLink\",\n source,\n apiName,\n target: elem\n });\n }\n }\n unlink(source, apiName, target) {\n if (!Array.isArray(target)) {\n this.edits.push({\n type: \"removeLink\",\n source,\n apiName,\n target\n });\n return;\n }\n for (const elem of target) {\n this.edits.push({\n type: \"removeLink\",\n source,\n apiName,\n target: elem\n });\n }\n }\n create(objectOrInterfaceType, properties) {\n if (objectOrInterfaceType.type === \"interface\") {\n this.edits.push({\n type: \"createObjectForInterface\",\n int: objectOrInterfaceType,\n properties\n });\n return;\n }\n this.edits.push({\n type: \"createObject\",\n obj: objectOrInterfaceType,\n properties\n });\n }\n delete(obj) {\n if (isInterfaceLocator(obj)) {\n this.edits.push({\n type: \"deleteObjectForInterface\",\n obj\n });\n return;\n }\n this.edits.push({\n type: \"deleteObject\",\n obj\n });\n }\n update(obj, properties) {\n if (isInterfaceLocator(obj)) {\n this.edits.push({\n type: \"updateObjectForInterface\",\n obj,\n properties\n });\n return;\n }\n this.edits.push({\n type: \"updateObject\",\n obj,\n properties\n });\n }\n getEdits() {\n return [...this.edits];\n }\n}\nexport function createEditBatch(_client) {\n return new InMemoryEditBatch();\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport class UserFacingError extends Error {\n constructor(message) {\n super(message);\n }\n}","/*\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 { foundryPlatformFetch as $foundryPlatformFetch } from \"@osdk/shared.net.platformapi\";\n//\nconst _abort = [1, \"/v2/mediasets/{0}/transactions/{1}/abort\", 2];\n/**\n * Aborts an open transaction. Items uploaded to the media set during this transaction will be deleted.\n *\n * @beta\n *\n * Required Scopes: [api:mediasets-write]\n * URL: /v2/mediasets/{mediaSetRid}/transactions/{transactionId}/abort\n */\nexport function abort($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _abort, ...args);\n}\nconst _calculate = [0, \"/v2/mediasets/{0}/items/{1}/transform/imagery/thumbnail/calculate\", 6];\n/**\n * Starts calculation of a thumbnail for a given image.\n *\n * @alpha\n *\n * Required Scopes: [api:mediasets-read]\n * URL: /v2/mediasets/{mediaSetRid}/items/{mediaItemRid}/transform/imagery/thumbnail/calculate\n */\nexport function calculate($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _calculate, ...args);\n}\nconst _commit = [1, \"/v2/mediasets/{0}/transactions/{1}/commit\", 2];\n/**\n * Commits an open transaction. On success, items uploaded to the media set during this transaction will become available.\n *\n * @beta\n *\n * Required Scopes: [api:mediasets-write]\n * URL: /v2/mediasets/{mediaSetRid}/transactions/{transactionId}/commit\n */\nexport function commit($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _commit, ...args);\n}\nconst _create = [1, \"/v2/mediasets/{0}/transactions\", 2];\n/**\n * Creates a new transaction. Items uploaded to the media set while this transaction is open will not be reflected until the transaction is committed.\n *\n * @beta\n *\n * Required Scopes: [api:mediasets-write]\n * URL: /v2/mediasets/{mediaSetRid}/transactions\n */\nexport function create($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _create, ...args);\n}\nconst _info = [0, \"/v2/mediasets/{0}/items/{1}\", 6];\n/**\n * Gets information about the media item.\n *\n * @beta\n *\n * Required Scopes: [api:mediasets-read]\n * URL: /v2/mediasets/{mediaSetRid}/items/{mediaItemRid}\n */\nexport function info($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _info, ...args);\n}\nconst _reference = [0, \"/v2/mediasets/{0}/items/{1}/reference\", 6];\n/**\n * Gets the [media reference](https://www.palantir.com/docs/foundry/data-integration/media-sets/#media-references) for this media item.\n *\n * @beta\n *\n * Required Scopes: [api:mediasets-read]\n * URL: /v2/mediasets/{mediaSetRid}/items/{mediaItemRid}/reference\n */\nexport function reference($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _reference, ...args);\n}\nconst _getRidByPath = [0, \"/v2/mediasets/{0}/items/getRidByPath\", 2];\n/**\n * Returns the media item RID for the media item with the specified path.\n *\n * @beta\n *\n * Required Scopes: [api:mediasets-read]\n * URL: /v2/mediasets/{mediaSetRid}/items/getRidByPath\n */\nexport function getRidByPath($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _getRidByPath, ...args);\n}\nconst _upload = [1, \"/v2/mediasets/{0}/items\", 3, \"*/*\"];\n/**\n * Uploads a media item to an existing media set.\n * The body of the request must contain the binary content of the file and the `Content-Type` header must be `application/octet-stream`.\n * A branch name, or branch rid, or view rid may optionally be specified. If none is specified, the item will be uploaded to the default branch. If more than one is specified, an error is thrown.\n *\n * @beta\n *\n * Required Scopes: [api:mediasets-write]\n * URL: /v2/mediasets/{mediaSetRid}/items\n */\nexport function upload($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _upload, ...args);\n}\nconst _read = [0, \"/v2/mediasets/{0}/items/{1}/content\", 6,, \"*/*\"];\n/**\n * Gets the content of a media item.\n *\n * @beta\n *\n * Required Scopes: [api:mediasets-read]\n * URL: /v2/mediasets/{mediaSetRid}/items/{mediaItemRid}/content\n */\nexport function read($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _read, ...args);\n}\nconst _readOriginal = [0, \"/v2/mediasets/{0}/items/{1}/original\", 6,, \"*/*\"];\n/**\n * Gets the content of an original file uploaded to the media item, even if it was transformed on upload due to being an additional input format.\n *\n * @beta\n *\n * Required Scopes: [api:mediasets-read]\n * URL: /v2/mediasets/{mediaSetRid}/items/{mediaItemRid}/original\n */\nexport function readOriginal($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _readOriginal, ...args);\n}\nconst _retrieve = [0, \"/v2/mediasets/{0}/items/{1}/transform/imagery/thumbnail/retrieve\", 6,, \"*/*\"];\n/**\n * Retrieves a successfully calculated thumbnail for a given image.\n *\n * Thumbnails are 200px wide in the format of `image/webp`\n *\n * @alpha\n *\n * Required Scopes: [api:mediasets-read]\n * URL: /v2/mediasets/{mediaSetRid}/items/{mediaItemRid}/transform/imagery/thumbnail/retrieve\n */\nexport function retrieve($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _retrieve, ...args);\n}\nconst _uploadMedia = [2, \"/v2/mediasets/media/upload\", 7, \"*/*\"];\n/**\n * Uploads a temporary media item. If the media item isn't persisted within 1 hour, the item will be deleted.\n *\n * If multiple resources are attributed to, usage will be attributed to the first one in the list.\n *\n * The body of the request must contain the binary content of the file and the `Content-Type` header must be `application/octet-stream`.\n * Third-party applications using this endpoint via OAuth2 must request the following operation scopes: `api:ontologies-read api:ontologies-write`.\n *\n * @beta\n *\n * Required Scopes: [api:ontologies-read, api:ontologies-write]\n * URL: /v2/mediasets/media/upload\n */\nexport function uploadMedia($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _uploadMedia, ...args);\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MediaSets } from \"@osdk/foundry.mediasets\";\nexport async function uploadMedia(client, mediaUpload) {\n const gatewayMediaRef = await MediaSets.uploadMedia(client, mediaUpload.data, {\n filename: mediaUpload.fileName,\n preview: true\n });\n return {\n mimeType: gatewayMediaRef.mimeType,\n reference: {\n type: \"mediaSetViewItem\",\n mediaSetViewItem: {\n mediaItemRid: gatewayMediaRef.reference.mediaSetViewItem.mediaItemRid,\n mediaSetRid: gatewayMediaRef.reference.mediaSetViewItem.mediaSetRid,\n mediaSetViewRid: gatewayMediaRef.reference.mediaSetViewItem.mediaSetViewRid,\n token: gatewayMediaRef.reference.mediaSetViewItem.token,\n readToken: gatewayMediaRef.reference.mediaSetViewItem.token\n }\n }\n };\n}"]}
|