@osdk/functions 1.5.0 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/build/browser/aliases/aliases.test.js +191 -0
- package/build/browser/aliases/aliases.test.js.map +1 -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/index.js +1 -0
- package/build/browser/index.js.map +1 -1
- package/build/browser/transactions/createWriteableClient.js +2 -0
- package/build/browser/transactions/createWriteableClient.js.map +1 -1
- package/build/cjs/index.cjs +133 -0
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +20 -1
- package/build/cjs/public/unstable-do-not-use.cjs +2 -0
- package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
- package/build/esm/aliases/aliases.test.js +191 -0
- package/build/esm/aliases/aliases.test.js.map +1 -0
- 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/index.js +1 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/transactions/createWriteableClient.js +2 -0
- package/build/esm/transactions/createWriteableClient.js.map +1 -1
- package/build/types/aliases/aliases.test.d.ts +1 -0
- package/build/types/aliases/aliases.test.d.ts.map +1 -0
- 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/index.d.ts +1 -0
- package/build/types/index.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aliases.test.js","names":["fs","afterEach","beforeEach","describe","expect","it","vi","custom","ALIASES_JSON_FILE_ENV_VAR","detectEnvironment","RESOURCES_JSON_FILE_ENV_VAR","resetPublishedCache","model","AliasEnvironment","testAliasesData","testResourcesData","hoisted","nodeFs","require","nodePath","aliasesPath","resolve","__dirname","resourcesPath","readFileSync","mock","process","env","toBe","PUBLISHED","LIVE_PREVIEW","toThrow","clearAllMocks","mocked","existsSync","mockReturnValue","result","toEqual","rid","result1","result2","toHaveBeenCalledTimes"],"sources":["aliases.test.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 { afterEach, beforeEach, describe, expect, it, vi } from \"vitest\";\nimport { custom } from \"./custom.js\";\nimport {\n ALIASES_JSON_FILE_ENV_VAR,\n detectEnvironment,\n RESOURCES_JSON_FILE_ENV_VAR,\n} from \"./environment.js\";\nimport { resetPublishedCache } from \"./loaders.js\";\nimport { model } from \"./model.js\";\nimport { AliasEnvironment } from \"./types.js\";\n\n// Read test data before mocking fs - use node:fs which is not affected by vi.mock(\"fs\")\nconst { testAliasesData, testResourcesData } = vi.hoisted(() => {\n const nodeFs = require(\"node:fs\");\n const nodePath = require(\"node:path\");\n const aliasesPath = nodePath.resolve(\n __dirname,\n \"./test-data/aliases.json\",\n );\n const resourcesPath = nodePath.resolve(\n __dirname,\n \"./test-data/resources.json\",\n );\n return {\n testAliasesData: nodeFs.readFileSync(aliasesPath, \"utf-8\") as string,\n testResourcesData: nodeFs.readFileSync(resourcesPath, \"utf-8\") as string,\n };\n});\n\nvi.mock(\"fs\");\n\ndescribe(\"environment detection\", () => {\n beforeEach(() => {\n delete process.env[ALIASES_JSON_FILE_ENV_VAR];\n delete process.env[RESOURCES_JSON_FILE_ENV_VAR];\n });\n\n afterEach(() => {\n delete process.env[ALIASES_JSON_FILE_ENV_VAR];\n delete process.env[RESOURCES_JSON_FILE_ENV_VAR];\n });\n\n it(\"detects published environment\", () => {\n process.env[ALIASES_JSON_FILE_ENV_VAR] = \"/some/path/aliases.json\";\n expect(detectEnvironment()).toBe(AliasEnvironment.PUBLISHED);\n });\n\n it(\"detects live preview environment\", () => {\n process.env[RESOURCES_JSON_FILE_ENV_VAR] = \"/some/path/resources.json\";\n expect(detectEnvironment()).toBe(AliasEnvironment.LIVE_PREVIEW);\n });\n\n it(\"throws when both env vars are set\", () => {\n process.env[ALIASES_JSON_FILE_ENV_VAR] = \"/some/path/aliases.json\";\n process.env[RESOURCES_JSON_FILE_ENV_VAR] = \"/some/path/resources.json\";\n expect(() => detectEnvironment()).toThrow(\n \"Ambiguous alias configuration\",\n );\n });\n\n it(\"throws when neither env var is set\", () => {\n expect(() => detectEnvironment()).toThrow(\n \"Unknown alias environment\",\n );\n });\n});\n\ndescribe(\"published mode aliases\", () => {\n beforeEach(() => {\n resetPublishedCache();\n vi.clearAllMocks();\n delete process.env[RESOURCES_JSON_FILE_ENV_VAR];\n process.env[ALIASES_JSON_FILE_ENV_VAR] = \"/app/var/data/aliases.json\";\n vi.mocked(fs.existsSync).mockReturnValue(true);\n vi.mocked(fs.readFileSync).mockReturnValue(testAliasesData);\n });\n\n afterEach(() => {\n delete process.env[ALIASES_JSON_FILE_ENV_VAR];\n delete process.env[RESOURCES_JSON_FILE_ENV_VAR];\n });\n\n describe(\"custom\", () => {\n it(\"loads alias successfully\", () => {\n const result = custom(\"myCustomAlias\");\n expect(result).toBe(\"myCustomValue\");\n });\n\n it(\"throws on nonexistent alias\", () => {\n expect(() => custom(\"nonexistent\")).toThrow(\n \"Custom alias 'nonexistent' not found. Available aliases: [myCustomAlias, anotherCustomAlias]\",\n );\n });\n\n it(\"selects correct alias from multiple\", () => {\n expect(custom(\"myCustomAlias\")).toBe(\"myCustomValue\");\n expect(custom(\"anotherCustomAlias\")).toBe(\"anotherCustomValue\");\n });\n });\n\n describe(\"model\", () => {\n it(\"loads alias successfully and returns rid\", () => {\n const result = model(\"myModelAlias\");\n expect(result).toEqual({\n rid: \"ri.foundry-ml.main.model.12345678-1234-1234-1234-123456789012\",\n });\n });\n\n it(\"throws on nonexistent alias\", () => {\n expect(() => model(\"nonexistent\")).toThrow(\n \"Model alias 'nonexistent' not found. Available aliases: [myModelAlias, anotherModelAlias]\",\n );\n });\n\n it(\"selects correct alias from multiple\", () => {\n const result1 = model(\"myModelAlias\");\n const result2 = model(\"anotherModelAlias\");\n expect(result1.rid).toBe(\n \"ri.foundry-ml.main.model.12345678-1234-1234-1234-123456789012\",\n );\n expect(result2.rid).toBe(\n \"ri.foundry-ml.main.model.87654321-4321-4321-4321-210987654321\",\n );\n });\n });\n\n describe(\"caching\", () => {\n it(\"reads file only once across multiple lookups\", () => {\n custom(\"myCustomAlias\");\n model(\"myModelAlias\");\n custom(\"anotherCustomAlias\");\n\n expect(fs.readFileSync).toHaveBeenCalledTimes(1);\n });\n\n it(\"re-reads after resetPublishedCache\", () => {\n custom(\"myCustomAlias\");\n expect(fs.readFileSync).toHaveBeenCalledTimes(1);\n\n resetPublishedCache();\n custom(\"myCustomAlias\");\n expect(fs.readFileSync).toHaveBeenCalledTimes(2);\n });\n });\n\n describe(\"file not found\", () => {\n it(\"throws when aliases file does not exist\", () => {\n vi.mocked(fs.existsSync).mockReturnValue(false);\n\n expect(() => custom(\"any-alias\")).toThrow(\n \"Aliases file not found at\",\n );\n });\n });\n});\n\ndescribe(\"live preview mode aliases\", () => {\n beforeEach(() => {\n vi.clearAllMocks();\n delete process.env[ALIASES_JSON_FILE_ENV_VAR];\n process.env[RESOURCES_JSON_FILE_ENV_VAR] = \"/app/var/data/resources.json\";\n vi.mocked(fs.existsSync).mockReturnValue(true);\n vi.mocked(fs.readFileSync).mockReturnValue(testResourcesData);\n });\n\n afterEach(() => {\n delete process.env[ALIASES_JSON_FILE_ENV_VAR];\n delete process.env[RESOURCES_JSON_FILE_ENV_VAR];\n });\n\n describe(\"custom\", () => {\n it(\"loads alias successfully\", () => {\n const result = custom(\"previewCustomAlias\");\n expect(result).toBe(\"previewCustomValue\");\n });\n\n it(\"throws on nonexistent alias\", () => {\n expect(() => custom(\"nonexistent\")).toThrow(\n \"Custom alias 'nonexistent' not found. Available aliases: [previewCustomAlias, anotherPreviewCustom]\",\n );\n });\n\n it(\"selects correct alias from multiple\", () => {\n expect(custom(\"previewCustomAlias\")).toBe(\"previewCustomValue\");\n expect(custom(\"anotherPreviewCustom\")).toBe(\"anotherPreviewValue\");\n });\n });\n\n describe(\"model\", () => {\n it(\"loads alias successfully and returns rid\", () => {\n const result = model(\"previewModelAlias\");\n expect(result).toEqual({\n rid: \"ri.foundry-ml.main.model.aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa\",\n });\n });\n\n it(\"throws on nonexistent alias\", () => {\n expect(() => model(\"nonexistent\")).toThrow(\n \"Model alias 'nonexistent' not found. Available aliases: [previewModelAlias, anotherPreviewModel]\",\n );\n });\n\n it(\"selects correct alias from multiple\", () => {\n const result1 = model(\"previewModelAlias\");\n const result2 = model(\"anotherPreviewModel\");\n expect(result1.rid).toBe(\n \"ri.foundry-ml.main.model.aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa\",\n );\n expect(result2.rid).toBe(\n \"ri.foundry-ml.main.model.bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb\",\n );\n });\n\n it(\"excludes models with null or missing alias\", () => {\n expect(() => model(\"some-random-lookup\")).toThrow(\n \"Available aliases: [previewModelAlias, anotherPreviewModel]\",\n );\n });\n });\n\n describe(\"no caching\", () => {\n it(\"re-reads file on every call\", () => {\n custom(\"previewCustomAlias\");\n custom(\"previewCustomAlias\");\n custom(\"previewCustomAlias\");\n\n expect(fs.readFileSync).toHaveBeenCalledTimes(3);\n });\n });\n\n describe(\"file not found\", () => {\n it(\"throws when resources file does not exist\", () => {\n vi.mocked(fs.existsSync).mockReturnValue(false);\n\n expect(() => custom(\"any-alias\")).toThrow(\n \"Resources file not found at\",\n );\n });\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,SAASC,SAAS,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAQ,QAAQ;AACxE,SAASC,MAAM,QAAQ,aAAa;AACpC,SACEC,yBAAyB,EACzBC,iBAAiB,EACjBC,2BAA2B,QACtB,kBAAkB;AACzB,SAASC,mBAAmB,QAAQ,cAAc;AAClD,SAASC,KAAK,QAAQ,YAAY;AAClC,SAASC,gBAAgB,QAAQ,YAAY;;A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ologies, 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":[]}
|
package/build/esm/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";
|
package/build/esm/index.js.map
CHANGED
|
@@ -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":[]}
|
|
@@ -78,6 +78,7 @@ export function createWriteableClient(transactionId, ...args) {
|
|
|
78
78
|
value: async function (obj, properties) {
|
|
79
79
|
const propertyMap = {};
|
|
80
80
|
for (const [key, value] of Object.entries(properties)) {
|
|
81
|
+
if (key.startsWith("$")) continue;
|
|
81
82
|
propertyMap[key] = toPropertyDataValue(value);
|
|
82
83
|
}
|
|
83
84
|
return editRequestManager.postEdit({
|
|
@@ -91,6 +92,7 @@ export function createWriteableClient(transactionId, ...args) {
|
|
|
91
92
|
value: function (locator, properties) {
|
|
92
93
|
const propertyMap = {};
|
|
93
94
|
for (const [key, value] of Object.entries(properties)) {
|
|
95
|
+
if (key.startsWith("$")) continue;
|
|
94
96
|
propertyMap[key] = toPropertyDataValue(value);
|
|
95
97
|
}
|
|
96
98
|
return editRequestManager.postEdit({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createWriteableClient.js","names":["createClientWithTransaction","EditRequestManager","toPropertyDataValue","writeableClientContext","createWriteableClient","transactionId","args","ontologyRid","client","editRequestManager","writeableClient","Object","defineProperties","link","value","source","apiName","target","Array","isArray","postEdit","type","objectType","$apiName","primaryKey","$primaryKey","linkType","linkedObjectPrimaryKey","promises","elem","push","Promise","all","then","undefined","unlink","create","obj","properties","propertyMap","key","entries","update","locator","delete"],"sources":["createWriteableClient.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 { createClientWithTransaction } from \"@osdk/client/unstable-do-not-use\";\n\nimport type { Client, createClient } from \"@osdk/client\";\nimport type {\n AddLinkApiNames,\n AddLinkSources,\n AddLinkTargets,\n CreatableObjectOrInterfaceTypeProperties,\n CreatableObjectOrInterfaceTypes,\n DeletableObjectOrInterfaceLocators,\n RemoveLinkApiNames,\n RemoveLinkSources,\n RemoveLinkTargets,\n UpdatableObjectOrInterfaceLocatorProperties,\n UpdatableObjectOrInterfaceLocators,\n} from \"../edits/EditBatch.js\";\nimport type { AnyEdit } from \"../edits/types.js\";\nimport { EditRequestManager } from \"./EditRequestManager.js\";\nimport { toPropertyDataValue } from \"./toPropertyDataValue.js\";\nimport type {\n WriteableClient,\n WriteableClientContext,\n WriteMethods,\n} from \"./WriteableClient.js\";\nimport { writeableClientContext } from \"./WriteableClient.js\";\n\nexport function createWriteableClient<\n X extends AnyEdit = never,\n>(\n transactionId: string,\n ...args: Parameters<typeof createClient>\n): WriteableClient<X> {\n const ontologyRid = args[1];\n\n const client = createClientWithTransaction(\n transactionId,\n async () => {},\n ...args,\n ) as Client;\n\n const editRequestManager = new EditRequestManager(\n client as WriteableClient<any>, // This cast is safe because we create the writeable client properties below.\n );\n\n // We use define properties because the client has non-enumerable properties that we want to preserve.\n const writeableClient = Object.defineProperties<Client>(\n client,\n {\n link: {\n value: function<\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 ): Promise<void> {\n if (!Array.isArray(target)) {\n return editRequestManager.postEdit({\n type: \"addLink\",\n objectType: source.$apiName,\n primaryKey: source.$primaryKey,\n linkType: apiName,\n linkedObjectPrimaryKey: target.$primaryKey,\n });\n }\n const promises: Promise<void>[] = [];\n\n for (const elem of target) {\n promises.push(\n editRequestManager.postEdit({\n type: \"addLink\",\n objectType: source.$apiName,\n primaryKey: source.$primaryKey,\n linkType: apiName,\n linkedObjectPrimaryKey: elem.$primaryKey,\n }),\n );\n }\n return Promise.all(promises).then(() => undefined);\n },\n },\n unlink: {\n value: function<\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 ): Promise<void> {\n if (!Array.isArray(target)) {\n return editRequestManager.postEdit({\n type: \"removeLink\",\n objectType: source.$apiName,\n primaryKey: source.$primaryKey,\n linkType: apiName,\n linkedObjectPrimaryKey: target.$primaryKey,\n });\n }\n const promises: Promise<void>[] = [];\n for (const elem of target) {\n promises.push(editRequestManager.postEdit({\n type: \"removeLink\",\n objectType: source.$apiName,\n primaryKey: source.$primaryKey,\n linkType: apiName,\n linkedObjectPrimaryKey: elem.$primaryKey,\n }));\n }\n return Promise.all(promises).then(() => undefined);\n },\n },\n create: {\n value: async function<OTD extends CreatableObjectOrInterfaceTypes<X>>(\n obj: OTD,\n properties: CreatableObjectOrInterfaceTypeProperties<X, OTD>,\n ): Promise<void> {\n const propertyMap: { [propertyName: string]: unknown } = {};\n for (const [key, value] of Object.entries(properties)) {\n propertyMap[key] = toPropertyDataValue(value);\n }\n return editRequestManager.postEdit({\n type: \"addObject\",\n objectType: obj.apiName,\n properties: propertyMap,\n });\n },\n },\n update: {\n value: function<\n SOL extends UpdatableObjectOrInterfaceLocators<X>,\n OTD extends UpdatableObjectOrInterfaceLocatorProperties<X, SOL>,\n >(\n locator: SOL,\n properties: OTD,\n ): Promise<void> {\n const propertyMap: { [propertyName: string]: unknown } = {};\n for (const [key, value] of Object.entries(properties)) {\n propertyMap[key] = toPropertyDataValue(value);\n }\n return editRequestManager.postEdit({\n type: \"modifyObject\",\n objectType: locator.$apiName,\n primaryKey: locator.$primaryKey,\n properties: propertyMap,\n });\n },\n },\n delete: {\n value: function<OL extends DeletableObjectOrInterfaceLocators<X>>(\n obj: OL,\n ): Promise<void> {\n return editRequestManager.postEdit({\n type: \"deleteObject\",\n objectType: obj.$apiName,\n primaryKey: obj.$primaryKey,\n });\n },\n },\n [writeableClientContext]: {\n value: {\n ontologyRid,\n transactionId,\n editRequestManager,\n } satisfies WriteableClientContext,\n },\n } satisfies Record<\n keyof WriteMethods<any> | typeof writeableClientContext,\n PropertyDescriptor\n >,\n ) as WriteableClient<X>;\n\n return writeableClient;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,2BAA2B,QAAQ,kCAAkC;AAiB9E,SAASC,kBAAkB,QAAQ,yBAAyB;AAC5D,SAASC,mBAAmB,QAAQ,0BAA0B;AAM9D,SAASC,sBAAsB,QAAQ,sBAAsB;AAE7D,OAAO,SAASC,qBAAqBA,CAGnCC,aAAqB,EACrB,GAAGC,IAAqC,EACpB;EACpB,MAAMC,WAAW,GAAGD,IAAI,CAAC,CAAC,CAAC;EAE3B,MAAME,MAAM,GAAGR,2BAA2B,CACxCK,aAAa,EACb,YAAY,CAAC,CAAC,EACd,GAAGC,IACL,CAAW;EAEX,MAAMG,kBAAkB,GAAG,IAAIR,kBAAkB,CAC/CO,MACF,CAAC,CADiC;EACjC;;EAED;EACA,MAAME,eAAe,GAAGC,MAAM,CAACC,gBAAgB,CAC7CJ,MAAM,EACN;IACEK,IAAI,EAAE;MACJC,KAAK,EAAE,SAAAA,CAILC,MAAW,EACXC,OAAU,EACVC,MAAiC,EAClB;QACf,IAAI,CAACC,KAAK,CAACC,OAAO,CAACF,MAAM,CAAC,EAAE;UAC1B,OAAOR,kBAAkB,CAACW,QAAQ,CAAC;YACjCC,IAAI,EAAE,SAAS;YACfC,UAAU,EAAEP,MAAM,CAACQ,QAAQ;YAC3BC,UAAU,EAAET,M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U,EAAEe,GAAG,CAACd,QAAQ;UACxBC,UAAU,EAAEa,GAAG,CAACZ;QAClB,CAAC,CAAC;MACJ;IACF,CAAC;IACD,CAACtB,sBAAsB,GAAG;MACxBW,KAAK,EAAE;QACLP,WAAW;QACXF,aAAa;QACbI;MACF;IACF;EACF,CAIF,CAAuB;EAEvB,OAAOC,eAAe;AACxB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"createWriteableClient.js","names":["createClientWithTransaction","EditRequestManager","toPropertyDataValue","writeableClientContext","createWriteableClient","transactionId","args","ontologyRid","client","editRequestManager","writeableClient","Object","defineProperties","link","value","source","apiName","target","Array","isArray","postEdit","type","objectType","$apiName","primaryKey","$primaryKey","linkType","linkedObjectPrimaryKey","promises","elem","push","Promise","all","then","undefined","unlink","create","obj","properties","propertyMap","key","entries","startsWith","update","locator","delete"],"sources":["createWriteableClient.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 { createClientWithTransaction } from \"@osdk/client/unstable-do-not-use\";\n\nimport type { Client, createClient } from \"@osdk/client\";\nimport type {\n AddLinkApiNames,\n AddLinkSources,\n AddLinkTargets,\n CreatableObjectOrInterfaceTypeProperties,\n CreatableObjectOrInterfaceTypes,\n DeletableObjectOrInterfaceLocators,\n RemoveLinkApiNames,\n RemoveLinkSources,\n RemoveLinkTargets,\n UpdatableObjectOrInterfaceLocatorProperties,\n UpdatableObjectOrInterfaceLocators,\n} from \"../edits/EditBatch.js\";\nimport type { AnyEdit } from \"../edits/types.js\";\nimport { EditRequestManager } from \"./EditRequestManager.js\";\nimport { toPropertyDataValue } from \"./toPropertyDataValue.js\";\nimport type {\n WriteableClient,\n WriteableClientContext,\n WriteMethods,\n} from \"./WriteableClient.js\";\nimport { writeableClientContext } from \"./WriteableClient.js\";\n\nexport function createWriteableClient<\n X extends AnyEdit = never,\n>(\n transactionId: string,\n ...args: Parameters<typeof createClient>\n): WriteableClient<X> {\n const ontologyRid = args[1];\n\n const client = createClientWithTransaction(\n transactionId,\n async () => {},\n ...args,\n ) as Client;\n\n const editRequestManager = new EditRequestManager(\n client as WriteableClient<any>, // This cast is safe because we create the writeable client properties below.\n );\n\n // We use define properties because the client has non-enumerable properties that we want to preserve.\n const writeableClient = Object.defineProperties<Client>(\n client,\n {\n link: {\n value: function<\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 ): Promise<void> {\n if (!Array.isArray(target)) {\n return editRequestManager.postEdit({\n type: \"addLink\",\n objectType: source.$apiName,\n primaryKey: source.$primaryKey,\n linkType: apiName,\n linkedObjectPrimaryKey: target.$primaryKey,\n });\n }\n const promises: Promise<void>[] = [];\n\n for (const elem of target) {\n promises.push(\n editRequestManager.postEdit({\n type: \"addLink\",\n objectType: source.$apiName,\n primaryKey: source.$primaryKey,\n linkType: apiName,\n linkedObjectPrimaryKey: elem.$primaryKey,\n }),\n );\n }\n return Promise.all(promises).then(() => undefined);\n },\n },\n unlink: {\n value: function<\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 ): Promise<void> {\n if (!Array.isArray(target)) {\n return editRequestManager.postEdit({\n type: \"removeLink\",\n objectType: source.$apiName,\n primaryKey: source.$primaryKey,\n linkType: apiName,\n linkedObjectPrimaryKey: target.$primaryKey,\n });\n }\n const promises: Promise<void>[] = [];\n for (const elem of target) {\n promises.push(editRequestManager.postEdit({\n type: \"removeLink\",\n objectType: source.$apiName,\n primaryKey: source.$primaryKey,\n linkType: apiName,\n linkedObjectPrimaryKey: elem.$primaryKey,\n }));\n }\n return Promise.all(promises).then(() => undefined);\n },\n },\n create: {\n value: async function<OTD extends CreatableObjectOrInterfaceTypes<X>>(\n obj: OTD,\n properties: CreatableObjectOrInterfaceTypeProperties<X, OTD>,\n ): Promise<void> {\n const propertyMap: { [propertyName: string]: unknown } = {};\n for (const [key, value] of Object.entries(properties)) {\n if (key.startsWith(\"$\")) continue;\n propertyMap[key] = toPropertyDataValue(value);\n }\n return editRequestManager.postEdit({\n type: \"addObject\",\n objectType: obj.apiName,\n properties: propertyMap,\n });\n },\n },\n update: {\n value: function<\n SOL extends UpdatableObjectOrInterfaceLocators<X>,\n OTD extends UpdatableObjectOrInterfaceLocatorProperties<X, SOL>,\n >(\n locator: SOL,\n properties: OTD,\n ): Promise<void> {\n const propertyMap: { [propertyName: string]: unknown } = {};\n for (const [key, value] of Object.entries(properties)) {\n if (key.startsWith(\"$\")) continue;\n propertyMap[key] = toPropertyDataValue(value);\n }\n return editRequestManager.postEdit({\n type: \"modifyObject\",\n objectType: locator.$apiName,\n primaryKey: locator.$primaryKey,\n properties: propertyMap,\n });\n },\n },\n delete: {\n value: function<OL extends DeletableObjectOrInterfaceLocators<X>>(\n obj: OL,\n ): Promise<void> {\n return editRequestManager.postEdit({\n type: \"deleteObject\",\n objectType: obj.$apiName,\n primaryKey: obj.$primaryKey,\n });\n },\n },\n [writeableClientContext]: {\n value: {\n ontologyRid,\n transactionId,\n editRequestManager,\n } satisfies WriteableClientContext,\n },\n } satisfies Record<\n keyof WriteMethods<any> | typeof writeableClientContext,\n PropertyDescriptor\n >,\n ) as WriteableClient<X>;\n\n return writeableClient;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,2BAA2B,QAAQ,kCAAkC;AAiB9E,SAASC,kBA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,kBAAkB,CAACW,QAAQ,CAAC;UACjCC,IAAI,EAAE,WAAW;UACjBC,UAAU,EAAEe,GAAG,CAACrB,OAAO;UACvBsB,UAAU,EAAEC;QACd,CAAC,CAAC;MACJ;IACF,CAAC;IACDI,MAAM,EAAE;MACN7B,KAAK,EAAE,SAAAA,CAIL8B,OAAY,EACZN,UAAe,EACA;QACf,MAAMC,WAAgD,GAAG,CAAC,CAAC;QAC3D,KAAK,MAAM,CAACC,GAAG,EAAE1B,KAAK,CAAC,IAAIH,MAAM,CAAC8B,OAAO,CAACH,UAAU,CAAC,EAAE;UACrD,IAAIE,GAAG,CAACE,UAAU,CAAC,GAAG,CAAC,EAAE;UACzBH,WAAW,CAACC,GAAG,CAAC,GAAGtC,mBAAmB,CAACY,KAAK,CAAC;QAC/C;QACA,OAAOL,kBAAkB,CAACW,QAAQ,CAAC;UACjCC,IAAI,EAAE,cAAc;UACpBC,UAAU,EAAEsB,OAAO,CAACrB,QAAQ;UAC5BC,UAAU,EAAEoB,OAAO,CAACnB,WAAW;UAC/Ba,UAAU,EAAEC;QACd,CAAC,CAAC;MACJ;IACF,CAAC;IACDM,MAAM,EAAE;MACN/B,KAAK,EAAE,SAAAA,CACLuB,GAAO,EACQ;QACf,OAAO5B,kBAAkB,CAACW,QAAQ,CAAC;UACjCC,IAAI,EAAE,cAAc;UACpBC,UAAU,EAAEe,GAAG,CAACd,QAAQ;UACxBC,UAAU,EAAEa,GAAG,CAACZ;QAClB,CAAC,CAAC;MACJ;IACF,CAAC;IACD,CAACtB,sBAAsB,GAAG;MACxBW,KAAK,EAAE;QACLP,WAAW;QACXF,aAAa;QACbI;MACF;IACF;EACF,CAIF,CAAuB;EAEvB,OAAOC,eAAe;AACxB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"","names":[],"sources":["../../../src/aliases/aliases.test.ts"],"version":3,"file":"aliases.test.d.ts"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAiBA,cAAc,cAAc,YAAa;AACzC,cAAc,cAAc;AAE5B,OAAO,iBAAS,OAAOA,gBAAgB","names":["alias: string"],"sources":["../../../src/aliases/custom.ts"],"version":3,"file":"custom.d.ts"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AliasEnvironment } from "./types.js";
|
|
2
|
+
export declare const ALIASES_JSON_FILE_ENV_VAR = "ALIASES_JSON_FILE";
|
|
3
|
+
export declare const RESOURCES_JSON_FILE_ENV_VAR = "RESOURCES_JSON_FILE";
|
|
4
|
+
export declare function detectEnvironment(): AliasEnvironment;
|
|
5
|
+
export declare function getAliasesFilePath(): string;
|
|
6
|
+
export declare function getResourcesFilePath(): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,SAAS,wBAAwB,YAAa;AAE9C,OAAO,cAAM,4BAA4B;AACzC,OAAO,cAAM,8BAA8B;AAE3C,OAAO,iBAAS,qBAAqB;AAuBrC,OAAO,iBAAS;AAUhB,OAAO,iBAAS","names":[],"sources":["../../../src/aliases/environment.ts"],"version":3,"file":"environment.d.ts"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cAAc;AACd,cAAc","names":[],"sources":["../../../src/aliases/index.ts"],"version":3,"file":"index.d.ts"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAuBA,cAIE,uBAEK,YAAa;AAgDpB,OAAO,iBAAS;AAIhB,OAAO,iBAAS,uBAAuB","names":[],"sources":["../../../src/aliases/loaders.ts"],"version":3,"file":"loaders.d.ts"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAiBA,cAAc,aAAa,YAAa;AACxC,cAAc,aAAa;AAE3B,OAAO,iBAAS,MAAMA,gBAAgB","names":["alias: string"],"sources":["../../../src/aliases/model.ts"],"version":3,"file":"model.d.ts"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export type Custom = string & {
|
|
2
|
+
readonly __brand: "Custom"
|
|
3
|
+
};
|
|
4
|
+
export interface Model {
|
|
5
|
+
rid: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ResolvedAliases {
|
|
8
|
+
custom: Record<string, string>;
|
|
9
|
+
models: Record<string, Model>;
|
|
10
|
+
}
|
|
11
|
+
export declare enum AliasEnvironment {
|
|
12
|
+
PUBLISHED = "PUBLISHED",
|
|
13
|
+
LIVE_PREVIEW = "LIVE_PREVIEW"
|
|
14
|
+
}
|
|
15
|
+
export interface ModelResource {
|
|
16
|
+
identifier: ModelIdentifier;
|
|
17
|
+
verbs: string[];
|
|
18
|
+
alias?: string | null;
|
|
19
|
+
}
|
|
20
|
+
export interface ResourceScopes {
|
|
21
|
+
custom: Record<string, string>;
|
|
22
|
+
models: ModelResource[];
|
|
23
|
+
}
|
|
24
|
+
export interface ResourcesFile {
|
|
25
|
+
resources: ResourceScopes;
|
|
26
|
+
}
|
|
27
|
+
export interface ModelIdentifier {
|
|
28
|
+
rid: string;
|
|
29
|
+
}
|
|
30
|
+
export interface ModelValue {
|
|
31
|
+
id: ModelIdentifier;
|
|
32
|
+
}
|
|
33
|
+
export interface DefaultAliases {
|
|
34
|
+
custom: Record<string, string>;
|
|
35
|
+
models: Record<string, ModelValue>;
|
|
36
|
+
}
|
|
37
|
+
export interface AliasesFile {
|
|
38
|
+
defaults: DefaultAliases;
|
|
39
|
+
version: number;
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAkBA,YAAY,kBAAkB;UAAW,SAAS;AAAU;AAE5D,iBAAiB,MAAM;CACrB;AACD;AAED,iBAAiB,gBAAgB;CAC/B,QAAQ;CACR,QAAQ,eAAe;AACxB;AAID,oBAAY,iBAAiB;CAC3B;CACA;AACD;AAID,iBAAiB,cAAc;CAC7B,YAAY;CACZ;CACA;AACD;AAED,iBAAiB,eAAe;CAC9B,QAAQ;CACR,QAAQ;AACT;AAED,iBAAiB,cAAc;CAC7B,WAAW;AACZ;AAID,iBAAiB,gBAAgB;CAC/B;AACD;AAED,iBAAiB,WAAW;CAC1B,IAAI;AACL;AAED,iBAAiB,eAAe;CAC9B,QAAQ;CACR,QAAQ,eAAe;AACxB;AAED,iBAAiB,YAAY;CAC3B,UAAU;CACV;AACD","names":[],"sources":["../../../src/aliases/types.ts"],"version":3,"file":"types.d.ts"}
|
package/build/types/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export type { DateISOString, Double, Float, Integer, Long, TimestampISOString } from "./PrimitiveTypes.js";
|
|
2
2
|
export type { Attachment, MediaReference, MediaUpload, Range, ThreeDimensionalAggregation, TwoDimensionalAggregation } from "@osdk/client";
|
|
3
|
+
export * as Aliases from "./aliases/index.js";
|
|
3
4
|
export { createEditBatch } from "./edits/createEditBatch.js";
|
|
4
5
|
export type { EditBatch } from "./edits/EditBatch.js";
|
|
5
6
|
export type { Edits } from "./edits/types.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cACE,eACA,QACA,OACA,SACA,MACA,0BACK;AAEP,cACE,YACA,gBACA,aACA,OACA,6BACA,iCACK;AAEP,SAAS,uBAAuB;AAChC,cAAc,iBAAiB;AAC/B,cAAc,aAAa;AAC3B,SAAS,uBAAuB;AAChC,SAAS,mBAAmB;AAE5B,cACE,mBACA,cACA,kBACA,wBACA,kBACA,sBACA,eACA,qBACK;AAEP,cAAc,uBAAuB,wBAAwB;AAC7D,cAAc,SAAS,WAAW,cAAc;AAEhD,cAAc,UAAU,aAAa","names":[],"sources":["../../src/index.ts"],"version":3,"file":"index.d.ts"}
|
|
1
|
+
{"mappings":"AAgBA,cACE,eACA,QACA,OACA,SACA,MACA,0BACK;AAEP,cACE,YACA,gBACA,aACA,OACA,6BACA,iCACK;AAEP,YAAY,aAAa;AACzB,SAAS,uBAAuB;AAChC,cAAc,iBAAiB;AAC/B,cAAc,aAAa;AAC3B,SAAS,uBAAuB;AAChC,SAAS,mBAAmB;AAE5B,cACE,mBACA,cACA,kBACA,wBACA,kBACA,sBACA,eACA,qBACK;AAEP,cAAc,uBAAuB,wBAAwB;AAC7D,cAAc,SAAS,WAAW,cAAc;AAEhD,cAAc,UAAU,aAAa","names":[],"sources":["../../src/index.ts"],"version":3,"file":"index.d.ts"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osdk/functions",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"access": "public",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"yaml": "^2.8.1"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"@osdk/client": "^2.7.
|
|
66
|
+
"@osdk/client": "^2.7.5"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@microsoft/api-documenter": "^7.26.32",
|
|
@@ -73,10 +73,10 @@
|
|
|
73
73
|
"p-defer": "^4.0.1",
|
|
74
74
|
"ts-expect": "^1.3.0",
|
|
75
75
|
"typescript": "~5.5.4",
|
|
76
|
-
"@osdk/client.test.ontology": "~2.7.
|
|
76
|
+
"@osdk/client.test.ontology": "~2.7.5",
|
|
77
|
+
"@osdk/monorepo.api-extractor": "~0.6.0",
|
|
77
78
|
"@osdk/monorepo.tsconfig": "~0.6.0",
|
|
78
|
-
"@osdk/shared.test": "~2.7.0"
|
|
79
|
-
"@osdk/monorepo.api-extractor": "~0.6.0"
|
|
79
|
+
"@osdk/shared.test": "~2.7.0"
|
|
80
80
|
},
|
|
81
81
|
"publishConfig": {
|
|
82
82
|
"access": "public"
|