@palantir/pack.core 0.27.0 → 0.28.0

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.
@@ -1,4 +1,4 @@
1
1
 
2
- > @palantir/pack.core@0.27.0 lint /home/runner/work/pack/pack/packages/core
2
+ > @palantir/pack.core@0.28.0 lint /home/runner/work/pack/pack/packages/core
3
3
  > eslint ./src && dprint check --config $(find-up dprint.json) --allow-no-files
4
4
 
@@ -1,5 +1,5 @@
1
1
 
2
- > @palantir/pack.core@0.27.0 transpileBrowser /home/runner/work/pack/pack/packages/core
2
+ > @palantir/pack.core@0.28.0 transpileBrowser /home/runner/work/pack/pack/packages/core
3
3
  > monorepo-transpile -f esm -m bundle -t browser
4
4
 
5
5
  👍
@@ -1,5 +1,5 @@
1
1
 
2
- > @palantir/pack.core@0.27.0 transpileCjs /home/runner/work/pack/pack/packages/core
2
+ > @palantir/pack.core@0.28.0 transpileCjs /home/runner/work/pack/pack/packages/core
3
3
  > monorepo-transpile -f cjs -m bundle -t node
4
4
 
5
5
  👍
@@ -1,5 +1,5 @@
1
1
 
2
- > @palantir/pack.core@0.27.0 transpileEsm /home/runner/work/pack/pack/packages/core
2
+ > @palantir/pack.core@0.28.0 transpileEsm /home/runner/work/pack/pack/packages/core
3
3
  > monorepo-transpile -f esm -m bundle -t node
4
4
 
5
5
  👍
@@ -1,5 +1,5 @@
1
1
 
2
- > @palantir/pack.core@0.27.0 transpileTypes /home/runner/work/pack/pack/packages/core
2
+ > @palantir/pack.core@0.28.0 transpileTypes /home/runner/work/pack/pack/packages/core
3
3
  > monorepo-transpile -f esm -m types -t node
4
4
 
5
5
  👍
@@ -1,4 +1,4 @@
1
1
 
2
- > @palantir/pack.core@0.27.0 typecheck /home/runner/work/pack/pack/packages/core
2
+ > @palantir/pack.core@0.28.0 typecheck /home/runner/work/pack/pack/packages/core
3
3
  > tsc --noEmit --emitDeclarationOnly false
4
4
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # @palantir/pack.core
2
2
 
3
+ ## 0.28.0
4
+
3
5
  ## 0.27.0
4
6
 
5
7
  ## 0.26.0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../node_modules/.pnpm/tiny-invariant@1.3.3/node_modules/tiny-invariant/dist/esm/tiny-invariant.js","../../src/types/PackApp.ts","../../src/utils/assertNever.ts","../../src/utils/generateId.ts","../../src/utils/getOntologyRid.ts","../../src/utils/justOnce.ts","../../src/utils/parseJwtPayload.ts"],"names":[],"mappings":";AAAA,IAAI,YAAA,GAAe,OAAA,CAAQ,GAAA,CAAI,QAAA,KAAa,YAAA;AAC5C,IAAI,MAAA,GAAS,kBAAA;AACb,SAAS,SAAA,CAAU,WAAW,OAAA,EAAS;AAIrC,EAAA,IAAI,YAAA,EAAc;AAChB,IAAA,MAAM,IAAI,MAAM,MAAM,CAAA;AAAA,EACxB;AACA,EAAA,IAAI,QAAA,GAAW,OAAO,OAAA,KAAY,UAAA,GAAa,SAAQ,GAAI,OAAA;AAC3D,EAAA,IAAI,KAAA,GAAQ,WAAW,EAAA,CAAG,MAAA,CAAO,QAAQ,IAAI,CAAA,CAAE,MAAA,CAAO,QAAQ,CAAA,GAAI,MAAA;AAClE,EAAA,MAAM,IAAI,MAAM,KAAK,CAAA;AACvB;;;ACqCO,IAAM,sBAAsB,CAAA,MAAA,KAAU;AAC3C,EAAA,OAAO,KAAA,CAAM,QAAQ,MAAM,CAAA;AAC7B;AASO,SAAS,oBAAoB,GAAA,EAAK;AACvC,EAAA,EAAE,WAAA,IAAe,GAAA,CAAA,GAAO,OAAA,CAAQ,GAAA,CAAI,QAAA,KAAa,YAAA,GAAe,SAAA,CAAU,KAAA,EAAO,+BAA+B,CAAA,GAAI,SAAA,CAAe,CAAA,GAAI,MAAA;AACzI;;;ACxCO,SAAS,YAAY,EAAA,EAAI;AAC9B,EAAA,MAAM,IAAI,MAAM,sBAAsB,CAAA;AACxC;;;ACHO,SAAS,UAAA,CAAW,QA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nvar prefix = 'Invariant failed';\nfunction invariant(condition, message) {\n if (condition) {\n return;\n }\n if (isProduction) {\n throw new Error(prefix);\n }\n var provided = typeof message === 'function' ? message() : message;\n var value = provided ? \"\".concat(prefix, \": \").concat(provided) : prefix;\n throw new Error(value);\n}\nexport { invariant as default };","/*\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 invariant from \"tiny-invariant\";\n\n/**\n * PackApp provides access to various pack subsystems.\n *\n * Specific modules are available after configuration and through declarations mixed in by import.\n * Eg for state system, if you import @palantir/pack.state.core you will have access to `app.state` accessor.\n * Similarly, auth is added automatically by initPackApp.\n *\n * @example\n * ```typescript\n * import { DocumentRef } from '@palantir/pack.state.core';\n * import { DocSchema } from '@my-app/schema';\n *\n * const app = initPackApp({\n * tokenProvider: () => 'your-token',\n * moduleConfigs: {\n * ...createPackDocumentServiceConfig({appId: 'your-app-id', documentType: 'your-document-type'})\n * },\n * });\n *\n * const docRef = app.state.createDocRef(docSchema, 'your-document-id');\n * const doc = await docRef.getSnapshot(); // get pojo of your doc state.\n * ```\n */\n\n/**\n * Module configuration - either a tuple of [ModuleKey, config] or just a ModuleKey (for modules with no config)\n */\n\n/**\n * Type guard to check if a ModuleConfig is a tuple configuration\n */\nexport const isModuleConfigTuple = config => {\n return Array.isArray(config);\n};\n\n/**\n * To simplify the public type interface on methods taking a PackApp,\n * this function asserts that the implementation is in fact a PackAppInternal\n * implementation, which allows internal module access and perhaps other\n * private functionality in the future.\n */\n\nexport function assertIsAppInternal(app) {\n !(\"getModule\" in app) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"App is not an PackAppInternal\") : invariant(false) : void 0;\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\n/**\n * Assert that a value type is never, useful for compile time exhaustiveness checking.\n *\n * If it is hit at runtime, it may indicate a bug in the code, or an unhandled case\n * for a new value added to a remotely loaded type.\n */\nexport function assertNever(_x) {\n throw new Error(\"Hit unreachable code\");\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\n/**\n * Generates a random ID using crypto library.\n * @param bytes Generate an ID with this many random bytes (default: 12)\n * @returns A hexadecimal string representation of the generated ID\n */\nexport function generateId(bytes = 12) {\n const array = new Int8Array(bytes);\n const r = crypto.getRandomValues(array);\n return toHexString(r);\n}\nfunction toHexString(byteArray) {\n return Array.from(byteArray, function (byte) {\n const h = (byte & 0xff).toString(16);\n return h.length === 1 ? `0${h}` : h;\n }).join(\"\");\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 async function getOntologyRid(app) {\n return app.config.ontologyRid;\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\nconst SEEN_KEYS = new Set();\n\n/**\n * Used to call fn only once between app reloads.\n * eg: Useful for logging warnings that should only be logged once.\n *\n * @example\n * ```ts\n * justOnce(\"unexpected-value\", () => console.warn(\"There was an unexpected value returned\", {value}));\n * ```\n */\nexport function justOnce(key, fn) {\n if (!SEEN_KEYS.has(key)) {\n SEEN_KEYS.add(key);\n fn();\n }\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\n/**\n * Parse JWT token payload without verification.\n * This does NOT verify the token signature - it only extracts payload data.\n * Use only for non-security-critical operations like testing or logging.\n *\n * @param token - JWT token string\n * @returns Parsed payload object\n * @throws Error if token format is invalid\n */\nexport function parseJwtPayload(token) {\n const parts = token.split(\".\");\n if (parts.length !== 3 || !parts[1]) {\n throw new Error(\"Invalid JWT token format\");\n }\n return JSON.parse(atob(parts[1]));\n}"]}
1
+ {"version":3,"sources":["../../../../node_modules/.pnpm/tiny-invariant@1.3.3/node_modules/tiny-invariant/dist/esm/tiny-invariant.js","../../src/types/PackApp.ts","../../src/utils/assertNever.ts","../../src/utils/generateId.ts","../../src/utils/getOntologyRid.ts","../../src/utils/justOnce.ts","../../src/utils/parseJwtPayload.ts"],"names":[],"mappings":";AAAA,IAAI,YAAA,GAAe,OAAA,CAAQ,GAAA,CAAI,QAAA,KAAa,YAAA;AAC5C,IAAI,MAAA,GAAS,kBAAA;AACb,SAAS,SAAA,CAAU,WAAW,OAAA,EAAS;AAIrC,EAAA,IAAI,YAAA,EAAc;AAChB,IAAA,MAAM,IAAI,MAAM,MAAM,CAAA;AAAA,EACxB;AACA,EAAA,IAAI,QAAA,GAAW,OAAO,OAAA,KAAY,UAAA,GAAa,SAAQ,GAAI,OAAA;AAC3D,EAAA,IAAI,KAAA,GAAQ,WAAW,EAAA,CAAG,MAAA,CAAO,QAAQ,IAAI,CAAA,CAAE,MAAA,CAAO,QAAQ,CAAA,GAAI,MAAA;AAClE,EAAA,MAAM,IAAI,MAAM,KAAK,CAAA;AACvB;;;ACoCO,IAAM,sBAAsB,CAAA,MAAA,KAAU;AAC3C,EAAA,OAAO,KAAA,CAAM,QAAQ,MAAM,CAAA;AAC7B;AASO,SAAS,oBAAoB,GAAA,EAAK;AACvC,EAAA,EAAE,WAAA,IAAe,GAAA,CAAA,GAAO,OAAA,CAAQ,GAAA,CAAI,QAAA,KAAa,YAAA,GAAe,SAAA,CAAU,KAAA,EAAO,+BAA+B,CAAA,GAAI,SAAA,CAAe,CAAA,GAAI,MAAA;AACzI;;;ACvCO,SAAS,YAAY,EAAA,EAAI;AAC9B,EAAA,MAAM,IAAI,MAAM,sBAAsB,CAAA;AACxC;;;ACHO,SAAS,UAAA,CAAW,QAAQ,EAAA,EAAI;AACrC,EAAA,MAAM,KAAA,GAAQ,IAAI,SAAA,CAAU,KAAK,CAAA;AACjC,EAAA,MAAM,CAAA,GAAI,MAAA,CAAO,eAAA,CAAgB,KAAK,CAAA;AACtC,EAAA,OAAO,YAAY,CAAC,CAAA;AACtB;AACA,SAAS,YAAY,SAAA,EAAW;AAC9B,EAAA,OAAO,KAAA,CAAM,IAAA,CAAK,SAAA,EAAW,SAAU,IAAA,EAAM;AAC3C,IAAA,MAAM,CAAA,GAAA,CAAK,IAAA,GAAO,GAAA,EAAM,QAAA,CAAS,EAAE,CAAA;AACnC,IAAA,OAAO,CAAA,CAAE,MAAA,KAAW,CAAA,GAAI,CAAA,CAAA,EAAI,CAAC,CAAA,CAAA,GAAK,CAAA;AAAA,EACpC,CAAC,CAAA,CAAE,IAAA,CAAK,EAAE,CAAA;AACZ;;;ACfA,eAAsB,eAAe,GAAA,EAAK;AACxC,EAAA,OAAO,IAAI,MAAA,CAAO,WAAA;AACpB;;;ACFA,IAAM,SAAA,uBAAgB,GAAA,EAAI;AAWnB,SAAS,QAAA,CAAS,KAAK,EAAA,EAAI;AAChC,EAAA,IAAI,CAAC,SAAA,CAAU,GAAA,CAAI,GAAG,CAAA,EAAG;AACvB,IAAA,SAAA,CAAU,IAAI,GAAG,CAAA;AACjB,IAAA,EAAA,EAAG;AAAA,EACL;AACF;;;ACPO,SAAS,gBAAgB,KAAA,EAAO;AACrC,EAAA,MAAM,KAAA,GAAQ,KAAA,CAAM,KAAA,CAAM,GAAG,CAAA;AAC7B,EAAA,IAAI,MAAM,MAAA,KAAW,CAAA,IAAK,CAAC,KAAA,CAAM,CAAC,CAAA,EAAG;AACnC,IAAA,MAAM,IAAI,MAAM,0BAA0B,CAAA;AAAA,EAC5C;AACA,EAAA,OAAO,KAAK,KAAA,CAAM,IAAA,CAAK,KAAA,CAAM,CAAC,CAAC,CAAC,CAAA;AAClC","file":"index.js","sourcesContent":["var isProduction = process.env.NODE_ENV === 'production';\nvar prefix = 'Invariant failed';\nfunction invariant(condition, message) {\n if (condition) {\n return;\n }\n if (isProduction) {\n throw new Error(prefix);\n }\n var provided = typeof message === 'function' ? message() : message;\n var value = provided ? \"\".concat(prefix, \": \").concat(provided) : prefix;\n throw new Error(value);\n}\nexport { invariant as default };","/*\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 invariant from \"tiny-invariant\";\n\n/**\n * PackApp provides access to various pack subsystems.\n *\n * `initPackApp` automatically initializes auth and adds `app.auth`. Optional modules are added\n * through builder methods. For example, `.withState()` initializes PACK's document state module\n * and adds the typed `app.state` accessor.\n *\n * @example\n * ```typescript\n * import { DocSchema } from '@my-app/schema';\n *\n * const app = initPackApp(client, {\n * app: { appId: 'your-app-id' },\n * ontologyRid: 'your-ontology-rid',\n * })\n * .withState()\n * .build();\n *\n * const docRef = app.state.createDocRef('your-document-id', DocSchema);\n * const doc = await docRef.getSnapshot(); // get pojo of your doc state.\n * ```\n */\n\n/**\n * Module configuration - either a tuple of [ModuleKey, config] or just a ModuleKey (for modules with no config)\n */\n\n/**\n * Type guard to check if a ModuleConfig is a tuple configuration\n */\nexport const isModuleConfigTuple = config => {\n return Array.isArray(config);\n};\n\n/**\n * To simplify the public type interface on methods taking a PackApp,\n * this function asserts that the implementation is in fact a PackAppInternal\n * implementation, which allows internal module access and perhaps other\n * private functionality in the future.\n */\n\nexport function assertIsAppInternal(app) {\n !(\"getModule\" in app) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"App is not an PackAppInternal\") : invariant(false) : void 0;\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\n/**\n * Assert that a value type is never, useful for compile time exhaustiveness checking.\n *\n * If it is hit at runtime, it may indicate a bug in the code, or an unhandled case\n * for a new value added to a remotely loaded type.\n */\nexport function assertNever(_x) {\n throw new Error(\"Hit unreachable code\");\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\n/**\n * Generates a random ID using crypto library.\n * @param bytes Generate an ID with this many random bytes (default: 12)\n * @returns A hexadecimal string representation of the generated ID\n */\nexport function generateId(bytes = 12) {\n const array = new Int8Array(bytes);\n const r = crypto.getRandomValues(array);\n return toHexString(r);\n}\nfunction toHexString(byteArray) {\n return Array.from(byteArray, function (byte) {\n const h = (byte & 0xff).toString(16);\n return h.length === 1 ? `0${h}` : h;\n }).join(\"\");\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 async function getOntologyRid(app) {\n return app.config.ontologyRid;\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\nconst SEEN_KEYS = new Set();\n\n/**\n * Used to call fn only once between app reloads.\n * eg: Useful for logging warnings that should only be logged once.\n *\n * @example\n * ```ts\n * justOnce(\"unexpected-value\", () => console.warn(\"There was an unexpected value returned\", {value}));\n * ```\n */\nexport function justOnce(key, fn) {\n if (!SEEN_KEYS.has(key)) {\n SEEN_KEYS.add(key);\n fn();\n }\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\n/**\n * Parse JWT token payload without verification.\n * This does NOT verify the token signature - it only extracts payload data.\n * Use only for non-security-critical operations like testing or logging.\n *\n * @param token - JWT token string\n * @returns Parsed payload object\n * @throws Error if token format is invalid\n */\nexport function parseJwtPayload(token) {\n const parts = token.split(\".\");\n if (parts.length !== 3 || !parts[1]) {\n throw new Error(\"Invalid JWT token format\");\n }\n return JSON.parse(atob(parts[1]));\n}"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../node_modules/.pnpm/tiny-invariant@1.3.3/node_modules/tiny-invariant/dist/esm/tiny-invariant.js","../../src/types/PackApp.ts","../../src/utils/assertNever.ts","../../src/utils/generateId.ts","../../src/utils/getOntologyRid.ts","../../src/utils/justOnce.ts","../../src/utils/parseJwtPayload.ts"],"names":[],"mappings":";;;AAAA,IAAI,YAAA,GAAe,OAAA,CAAQ,GAAA,CAAI,QAAA,KAAa,YAAA;AAC5C,IAAI,MAAA,GAAS,kBAAA;AACb,SAAS,SAAA,CAAU,WAAW,OAAA,EAAS;AAIrC,EAAA,IAAI,YAAA,EAAc;AAChB,IAAA,MAAM,IAAI,MAAM,MAAM,CAAA;AAAA,EACxB;AACA,EAAA,IAAI,QAAA,GAAW,OAAO,OAAA,KAAY,UAAA,GAAa,SAAQ,GAAI,OAAA;AAC3D,EAAA,IAAI,KAAA,GAAQ,WAAW,EAAA,CAAG,MAAA,CAAO,QAAQ,IAAI,CAAA,CAAE,MAAA,CAAO,QAAQ,CAAA,GAAI,MAAA;AAClE,EAAA,MAAM,IAAI,MAAM,KAAK,CAAA;AACvB;;;ACqCO,IAAM,sBAAsB,CAAA,MAAA,KAAU;AAC3C,EAAA,OAAO,KAAA,CAAM,QAAQ,MAAM,CAAA;AAC7B;AASO,SAAS,oBAAoB,GAAA,EAAK;AACvC,EAAA,EAAE,WAAA,IAAe,GAAA,CAAA,GAAO,OAAA,CAAQ,GAAA,CAAI,QAAA,KAAa,YAAA,GAAe,SAAA,CAAU,KAAA,EAAO,+BAA+B,CAAA,GAAI,SAAA,CAAe,CAAA,GAAI,MAAA;AACzI;;;ACxCO,SAAS,YAAY,EAAA,EAAI;AAC9B,EAAA,MAAM,IAAI,MAAM,sBAAsB,CAAA;AACxC;;;ACHO,SAAS,UAAA,CAAW,QAAQ,EAAA,EAAI;AACrC,EAAA,MAAM,KAAA,GAAQ,IAAI,SAAA,CAAU,KAAK,CAAA;AACjC,EAAA,MAAM,CAAA,GAAI,MAAA,CAAO,eAAA,CAAgB,KAAK,CAAA;AACtC,EAAA,OAAO,YAAY,CAAC,CAAA;AACtB;AACA,SAAS,YAAY,SAAA,EAAW;AAC9B,EAAA,OAAO,KAAA,CAAM,IAAA,CAAK,SAAA,EAAW,SAAU,IAAA,EAAM;AAC3C,IAAA,MAAM,CAAA,GAAA,CAAK,IAAA,GAAO,GAAA,EAAM,QAAA,CAAS,EAAE,CAAA;AACnC,IAAA,OAAO,CAAA,CAAE,MAAA,KAAW,CAAA,GAAI,CAAA,CAAA,EAAI,CAAC,CAAA,CAAA,GAAK,CAAA;AAAA,EACpC,CAAC,CAAA,CAAE,IAAA,CAAK,EAAE,CAAA;AACZ;;;ACfA,eAAsB,eAAe,GAAA,EAAK;AACxC,EAAA,OAAO,IAAI,MAAA,CAAO,WAAA;AACpB;;;ACFA,IAAM,SAAA,uBAAgB,GAAA,EAAI;AAWnB,SAAS,QAAA,CAAS,KAAK,EAAA,EAAI;AAChC,EAAA,IAAI,CAAC,SAAA,CAAU,GAAA,CAAI,GAAG,CAAA,EAAG;AACvB,IAAA,SAAA,CAAU,IAAI,GAAG,CAAA;AACjB,IAAA,EAAA,EAAG;AAAA,EACL;AACF;;;ACPO,SAAS,gBAAgB,KAAA,EAAO;AACrC,EAAA,MAAM,KAAA,GAAQ,KAAA,CAAM,KAAA,CAAM,GAAG,CAAA;AAC7B,EAAA,IAAI,MAAM,MAAA,KAAW,CAAA,IAAK,CAAC,KAAA,CAAM,CAAC,CAAA,EAAG;AACnC,IAAA,MAAM,IAAI,MAAM,0BAA0B,CAAA;AAAA,EAC5C;AACA,EAAA,OAAO,KAAK,KAAA,CAAM,IAAA,CAAK,KAAA,CAAM,CAAC,CAAC,CAAC,CAAA;AAClC","file":"index.cjs","sourcesContent":["var isProduction = process.env.NODE_ENV === 'production';\nvar prefix = 'Invariant failed';\nfunction invariant(condition, message) {\n if (condition) {\n return;\n }\n if (isProduction) {\n throw new Error(prefix);\n }\n var provided = typeof message === 'function' ? message() : message;\n var value = provided ? \"\".concat(prefix, \": \").concat(provided) : prefix;\n throw new Error(value);\n}\nexport { invariant as default };","/*\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 invariant from \"tiny-invariant\";\n\n/**\n * PackApp provides access to various pack subsystems.\n *\n * Specific modules are available after configuration and through declarations mixed in by import.\n * Eg for state system, if you import @palantir/pack.state.core you will have access to `app.state` accessor.\n * Similarly, auth is added automatically by initPackApp.\n *\n * @example\n * ```typescript\n * import { DocumentRef } from '@palantir/pack.state.core';\n * import { DocSchema } from '@my-app/schema';\n *\n * const app = initPackApp({\n * tokenProvider: () => 'your-token',\n * moduleConfigs: {\n * ...createPackDocumentServiceConfig({appId: 'your-app-id', documentType: 'your-document-type'})\n * },\n * });\n *\n * const docRef = app.state.createDocRef(docSchema, 'your-document-id');\n * const doc = await docRef.getSnapshot(); // get pojo of your doc state.\n * ```\n */\n\n/**\n * Module configuration - either a tuple of [ModuleKey, config] or just a ModuleKey (for modules with no config)\n */\n\n/**\n * Type guard to check if a ModuleConfig is a tuple configuration\n */\nexport const isModuleConfigTuple = config => {\n return Array.isArray(config);\n};\n\n/**\n * To simplify the public type interface on methods taking a PackApp,\n * this function asserts that the implementation is in fact a PackAppInternal\n * implementation, which allows internal module access and perhaps other\n * private functionality in the future.\n */\n\nexport function assertIsAppInternal(app) {\n !(\"getModule\" in app) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"App is not an PackAppInternal\") : invariant(false) : void 0;\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\n/**\n * Assert that a value type is never, useful for compile time exhaustiveness checking.\n *\n * If it is hit at runtime, it may indicate a bug in the code, or an unhandled case\n * for a new value added to a remotely loaded type.\n */\nexport function assertNever(_x) {\n throw new Error(\"Hit unreachable code\");\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\n/**\n * Generates a random ID using crypto library.\n * @param bytes Generate an ID with this many random bytes (default: 12)\n * @returns A hexadecimal string representation of the generated ID\n */\nexport function generateId(bytes = 12) {\n const array = new Int8Array(bytes);\n const r = crypto.getRandomValues(array);\n return toHexString(r);\n}\nfunction toHexString(byteArray) {\n return Array.from(byteArray, function (byte) {\n const h = (byte & 0xff).toString(16);\n return h.length === 1 ? `0${h}` : h;\n }).join(\"\");\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 async function getOntologyRid(app) {\n return app.config.ontologyRid;\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\nconst SEEN_KEYS = new Set();\n\n/**\n * Used to call fn only once between app reloads.\n * eg: Useful for logging warnings that should only be logged once.\n *\n * @example\n * ```ts\n * justOnce(\"unexpected-value\", () => console.warn(\"There was an unexpected value returned\", {value}));\n * ```\n */\nexport function justOnce(key, fn) {\n if (!SEEN_KEYS.has(key)) {\n SEEN_KEYS.add(key);\n fn();\n }\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\n/**\n * Parse JWT token payload without verification.\n * This does NOT verify the token signature - it only extracts payload data.\n * Use only for non-security-critical operations like testing or logging.\n *\n * @param token - JWT token string\n * @returns Parsed payload object\n * @throws Error if token format is invalid\n */\nexport function parseJwtPayload(token) {\n const parts = token.split(\".\");\n if (parts.length !== 3 || !parts[1]) {\n throw new Error(\"Invalid JWT token format\");\n }\n return JSON.parse(atob(parts[1]));\n}"]}
1
+ {"version":3,"sources":["../../../../node_modules/.pnpm/tiny-invariant@1.3.3/node_modules/tiny-invariant/dist/esm/tiny-invariant.js","../../src/types/PackApp.ts","../../src/utils/assertN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,OAAO,KAAA,CAAM,IAAA,CAAK,SAAA,EAAW,SAAU,IAAA,EAAM;AAC3C,IAAA,MAAM,CAAA,GAAA,CAAK,IAAA,GAAO,GAAA,EAAM,QAAA,CAAS,EAAE,CAAA;AACnC,IAAA,OAAO,CAAA,CAAE,MAAA,KAAW,CAAA,GAAI,CAAA,CAAA,EAAI,CAAC,CAAA,CAAA,GAAK,CAAA;AAAA,EACpC,CAAC,CAAA,CAAE,IAAA,CAAK,EAAE,CAAA;AACZ;;;ACfA,eAAsB,eAAe,GAAA,EAAK;AACxC,EAAA,OAAO,IAAI,MAAA,CAAO,WAAA;AACpB;;;ACFA,IAAM,SAAA,uBAAgB,GAAA,EAAI;AAWnB,SAAS,QAAA,CAAS,KAAK,EAAA,EAAI;AAChC,EAAA,IAAI,CAAC,SAAA,CAAU,GAAA,CAAI,GAAG,CAAA,EAAG;AACvB,IAAA,SAAA,CAAU,IAAI,GAAG,CAAA;AACjB,IAAA,EAAA,EAAG;AAAA,EACL;AACF;;;ACPO,SAAS,gBAAgB,KAAA,EAAO;AACrC,EAAA,MAAM,KAAA,GAAQ,KAAA,CAAM,KAAA,CAAM,GAAG,CAAA;AAC7B,EAAA,IAAI,MAAM,MAAA,KAAW,CAAA,IAAK,CAAC,KAAA,CAAM,CAAC,CAAA,EAAG;AACnC,IAAA,MAAM,IAAI,MAAM,0BAA0B,CAAA;AAAA,EAC5C;AACA,EAAA,OAAO,KAAK,KAAA,CAAM,IAAA,CAAK,KAAA,CAAM,CAAC,CAAC,CAAC,CAAA;AAClC","file":"index.cjs","sourcesContent":["var isProduction = process.env.NODE_ENV === 'production';\nvar prefix = 'Invariant failed';\nfunction invariant(condition, message) {\n if (condition) {\n return;\n }\n if (isProduction) {\n throw new Error(prefix);\n }\n var provided = typeof message === 'function' ? message() : message;\n var value = provided ? \"\".concat(prefix, \": \").concat(provided) : prefix;\n throw new Error(value);\n}\nexport { invariant as default };","/*\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 invariant from \"tiny-invariant\";\n\n/**\n * PackApp provides access to various pack subsystems.\n *\n * `initPackApp` automatically initializes auth and adds `app.auth`. Optional modules are added\n * through builder methods. For example, `.withState()` initializes PACK's document state module\n * and adds the typed `app.state` accessor.\n *\n * @example\n * ```typescript\n * import { DocSchema } from '@my-app/schema';\n *\n * const app = initPackApp(client, {\n * app: { appId: 'your-app-id' },\n * ontologyRid: 'your-ontology-rid',\n * })\n * .withState()\n * .build();\n *\n * const docRef = app.state.createDocRef('your-document-id', DocSchema);\n * const doc = await docRef.getSnapshot(); // get pojo of your doc state.\n * ```\n */\n\n/**\n * Module configuration - either a tuple of [ModuleKey, config] or just a ModuleKey (for modules with no config)\n */\n\n/**\n * Type guard to check if a ModuleConfig is a tuple configuration\n */\nexport const isModuleConfigTuple = config => {\n return Array.isArray(config);\n};\n\n/**\n * To simplify the public type interface on methods taking a PackApp,\n * this function asserts that the implementation is in fact a PackAppInternal\n * implementation, which allows internal module access and perhaps other\n * private functionality in the future.\n */\n\nexport function assertIsAppInternal(app) {\n !(\"getModule\" in app) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"App is not an PackAppInternal\") : invariant(false) : void 0;\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\n/**\n * Assert that a value type is never, useful for compile time exhaustiveness checking.\n *\n * If it is hit at runtime, it may indicate a bug in the code, or an unhandled case\n * for a new value added to a remotely loaded type.\n */\nexport function assertNever(_x) {\n throw new Error(\"Hit unreachable code\");\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\n/**\n * Generates a random ID using crypto library.\n * @param bytes Generate an ID with this many random bytes (default: 12)\n * @returns A hexadecimal string representation of the generated ID\n */\nexport function generateId(bytes = 12) {\n const array = new Int8Array(bytes);\n const r = crypto.getRandomValues(array);\n return toHexString(r);\n}\nfunction toHexString(byteArray) {\n return Array.from(byteArray, function (byte) {\n const h = (byte & 0xff).toString(16);\n return h.length === 1 ? `0${h}` : h;\n }).join(\"\");\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 async function getOntologyRid(app) {\n return app.config.ontologyRid;\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\nconst SEEN_KEYS = new Set();\n\n/**\n * Used to call fn only once between app reloads.\n * eg: Useful for logging warnings that should only be logged once.\n *\n * @example\n * ```ts\n * justOnce(\"unexpected-value\", () => console.warn(\"There was an unexpected value returned\", {value}));\n * ```\n */\nexport function justOnce(key, fn) {\n if (!SEEN_KEYS.has(key)) {\n SEEN_KEYS.add(key);\n fn();\n }\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\n/**\n * Parse JWT token payload without verification.\n * This does NOT verify the token signature - it only extracts payload data.\n * Use only for non-security-critical operations like testing or logging.\n *\n * @param token - JWT token string\n * @returns Parsed payload object\n * @throws Error if token format is invalid\n */\nexport function parseJwtPayload(token) {\n const parts = token.split(\".\");\n if (parts.length !== 3 || !parts[1]) {\n throw new Error(\"Invalid JWT token format\");\n }\n return JSON.parse(atob(parts[1]));\n}"]}
@@ -54,23 +54,22 @@ interface ModuleKey<T, TConfig = unknown> {
54
54
  /**
55
55
  * PackApp provides access to various pack subsystems.
56
56
  *
57
- * Specific modules are available after configuration and through declarations mixed in by import.
58
- * Eg for state system, if you import @palantir/pack.state.core you will have access to `app.state` accessor.
59
- * Similarly, auth is added automatically by initPackApp.
57
+ * `initPackApp` automatically initializes auth and adds `app.auth`. Optional modules are added
58
+ * through builder methods. For example, `.withState()` initializes PACK's document state module
59
+ * and adds the typed `app.state` accessor.
60
60
  *
61
61
  * @example
62
62
  * ```typescript
63
- * import { DocumentRef } from '@palantir/pack.state.core';
64
63
  * import { DocSchema } from '@my-app/schema';
65
64
  *
66
- * const app = initPackApp({
67
- * tokenProvider: () => 'your-token',
68
- * moduleConfigs: {
69
- * ...createPackDocumentServiceConfig({appId: 'your-app-id', documentType: 'your-document-type'})
70
- * },
71
- * });
65
+ * const app = initPackApp(client, {
66
+ * app: { appId: 'your-app-id' },
67
+ * ontologyRid: 'your-ontology-rid',
68
+ * })
69
+ * .withState()
70
+ * .build();
72
71
  *
73
- * const docRef = app.state.createDocRef(docSchema, 'your-document-id');
72
+ * const docRef = app.state.createDocRef('your-document-id', DocSchema);
74
73
  * const doc = await docRef.getSnapshot(); // get pojo of your doc state.
75
74
  * ```
76
75
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../node_modules/.pnpm/tiny-invariant@1.3.3/node_modules/tiny-invariant/dist/esm/tiny-invariant.js","../../src/types/PackApp.ts","../../src/utils/assertNever.ts","../../src/utils/generateId.ts","../../src/utils/getOntologyRid.ts","../../src/utils/justOnce.ts","../../src/utils/parseJwtPayload.ts"],"names":[],"mappings":";AAAA,IAAI,YAAA,GAAe,OAAA,CAAQ,GAAA,CAAI,QAAA,KAAa,YAAA;AAC5C,IAAI,MAAA,GAAS,kBAAA;AACb,SAAS,SAAA,CAAU,WAAW,OAAA,EAAS;AAIrC,EAAA,IAAI,YAAA,EAAc;AAChB,IAAA,MAAM,IAAI,MAAM,MAAM,CAAA;AAAA,EACxB;AACA,EAAA,IAAI,QAAA,GAAW,OAAO,OAAA,KAAY,UAAA,GAAa,SAAQ,GAAI,OAAA;AAC3D,EAAA,IAAI,KAAA,GAAQ,WAAW,EAAA,CAAG,MAAA,CAAO,QAAQ,IAAI,CAAA,CAAE,MAAA,CAAO,QAAQ,CAAA,GAAI,MAAA;AAClE,EAAA,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vB,IAAA,SAAA,CAAU,IAAI,GAAG,CAAA;AACjB,IAAA,EAAA,EAAG;AAAA,EACL;AACF;;;ACPO,SAAS,gBAAgB,KAAA,EAAO;AACrC,EAAA,MAAM,KAAA,GAAQ,KAAA,CAAM,KAAA,CAAM,GAAG,CAAA;AAC7B,EAAA,IAAI,MAAM,MAAA,KAAW,CAAA,IAAK,CAAC,KAAA,CAAM,CAAC,CAAA,EAAG;AACnC,IAAA,MAAM,IAAI,MAAM,0BAA0B,CAAA;AAAA,EAC5C;AACA,EAAA,OAAO,KAAK,KAAA,CAAM,IAAA,CAAK,KAAA,CAAM,CAAC,CAAC,CAAC,CAAA;AAClC","file":"index.js","sourcesContent":["var isProduction = process.env.NODE_ENV === 'production';\nvar prefix = 'Invariant failed';\nfunction invariant(condition, message) {\n if (condition) {\n return;\n }\n if (isProduction) {\n throw new Error(prefix);\n }\n var provided = typeof message === 'function' ? message() : message;\n var value = provided ? \"\".concat(prefix, \": \").concat(provided) : prefix;\n throw new Error(value);\n}\nexport { invariant as default };","/*\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 invariant from \"tiny-invariant\";\n\n/**\n * PackApp provides access to various pack subsystems.\n *\n * Specific modules are available after configuration and through declarations mixed in by import.\n * Eg for state system, if you import @palantir/pack.state.core you will have access to `app.state` accessor.\n * Similarly, auth is added automatically by initPackApp.\n *\n * @example\n * ```typescript\n * import { DocumentRef } from '@palantir/pack.state.core';\n * import { DocSchema } from '@my-app/schema';\n *\n * const app = initPackApp({\n * tokenProvider: () => 'your-token',\n * moduleConfigs: {\n * ...createPackDocumentServiceConfig({appId: 'your-app-id', documentType: 'your-document-type'})\n * },\n * });\n *\n * const docRef = app.state.createDocRef(docSchema, 'your-document-id');\n * const doc = await docRef.getSnapshot(); // get pojo of your doc state.\n * ```\n */\n\n/**\n * Module configuration - either a tuple of [ModuleKey, config] or just a ModuleKey (for modules with no config)\n */\n\n/**\n * Type guard to check if a ModuleConfig is a tuple configuration\n */\nexport const isModuleConfigTuple = config => {\n return Array.isArray(config);\n};\n\n/**\n * To simplify the public type interface on methods taking a PackApp,\n * this function asserts that the implementation is in fact a PackAppInternal\n * implementation, which allows internal module access and perhaps other\n * private functionality in the future.\n */\n\nexport function assertIsAppInternal(app) {\n !(\"getModule\" in app) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"App is not an PackAppInternal\") : invariant(false) : void 0;\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\n/**\n * Assert that a value type is never, useful for compile time exhaustiveness checking.\n *\n * If it is hit at runtime, it may indicate a bug in the code, or an unhandled case\n * for a new value added to a remotely loaded type.\n */\nexport function assertNever(_x) {\n throw new Error(\"Hit unreachable code\");\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\n/**\n * Generates a random ID using crypto library.\n * @param bytes Generate an ID with this many random bytes (default: 12)\n * @returns A hexadecimal string representation of the generated ID\n */\nexport function generateId(bytes = 12) {\n const array = new Int8Array(bytes);\n const r = crypto.getRandomValues(array);\n return toHexString(r);\n}\nfunction toHexString(byteArray) {\n return Array.from(byteArray, function (byte) {\n const h = (byte & 0xff).toString(16);\n return h.length === 1 ? `0${h}` : h;\n }).join(\"\");\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 async function getOntologyRid(app) {\n return app.config.ontologyRid;\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\nconst SEEN_KEYS = new Set();\n\n/**\n * Used to call fn only once between app reloads.\n * eg: Useful for logging warnings that should only be logged once.\n *\n * @example\n * ```ts\n * justOnce(\"unexpected-value\", () => console.warn(\"There was an unexpected value returned\", {value}));\n * ```\n */\nexport function justOnce(key, fn) {\n if (!SEEN_KEYS.has(key)) {\n SEEN_KEYS.add(key);\n fn();\n }\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\n/**\n * Parse JWT token payload without verification.\n * This does NOT verify the token signature - it only extracts payload data.\n * Use only for non-security-critical operations like testing or logging.\n *\n * @param token - JWT token string\n * @returns Parsed payload object\n * @throws Error if token format is invalid\n */\nexport function parseJwtPayload(token) {\n const parts = token.split(\".\");\n if (parts.length !== 3 || !parts[1]) {\n throw new Error(\"Invalid JWT token format\");\n }\n return JSON.parse(atob(parts[1]));\n}"]}
1
+ {"version":3,"sources":["../../../../node_modules/.pnpm/tiny-invariant@1.3.3/node_modules/tiny-invariant/dist/esm/tiny-invariant.js","../../src/types/PackApp.ts","../../src/utils/assertNever.ts","../../src/utils/generateId.ts","../../src/utils/getOntologyRid.ts","../../src/utils/justOnce.ts","../../src/utils/parseJwtPayload.ts"],"names":[],"mappings":";AAAA,IAAI,YAAA,GAAe,OAAA,CAAQ,GAAA,CAAI,QAAA,KAAa,YAAA;AAC5C,IAAI,MAAA,GAAS,kBAAA;AACb,SAAS,SAAA,CAAU,WAAW,OAAA,EAAS;AAIrC,EAAA,IAAI,YAAA,EAAc;AAChB,IAAA,MAAM,IAAI,MAAM,MAAM,CAAA;AAAA,EACxB;AACA,EAAA,IAAI,QAAA,GAAW,OAAO,OAAA,KAAY,UAAA,GAAa,SAAQ,GAAI,OAAA;AAC3D,EAAA,IAAI,KAAA,GAAQ,WAAW,EAAA,CAAG,MAAA,CAAO,QAAQ,IAAI,CAAA,CAAE,MAAA,CAAO,QAAQ,CAAA,GAAI,MAAA;AAClE,EAAA,MAAM,IAAI,MAAM,KAAK,CAAA;AACvB;;;ACoCO,IAAM,sBAAsB,C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G;AAAA,EACL;AACF;;;ACPO,SAAS,gBAAgB,KAAA,EAAO;AACrC,EAAA,MAAM,KAAA,GAAQ,KAAA,CAAM,KAAA,CAAM,GAAG,CAAA;AAC7B,EAAA,IAAI,MAAM,MAAA,KAAW,CAAA,IAAK,CAAC,KAAA,CAAM,CAAC,CAAA,EAAG;AACnC,IAAA,MAAM,IAAI,MAAM,0BAA0B,CAAA;AAAA,EAC5C;AACA,EAAA,OAAO,KAAK,KAAA,CAAM,IAAA,CAAK,KAAA,CAAM,CAAC,CAAC,CAAC,CAAA;AAClC","file":"index.js","sourcesContent":["var isProduction = process.env.NODE_ENV === 'production';\nvar prefix = 'Invariant failed';\nfunction invariant(condition, message) {\n if (condition) {\n return;\n }\n if (isProduction) {\n throw new Error(prefix);\n }\n var provided = typeof message === 'function' ? message() : message;\n var value = provided ? \"\".concat(prefix, \": \").concat(provided) : prefix;\n throw new Error(value);\n}\nexport { invariant as default };","/*\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 invariant from \"tiny-invariant\";\n\n/**\n * PackApp provides access to various pack subsystems.\n *\n * `initPackApp` automatically initializes auth and adds `app.auth`. Optional modules are added\n * through builder methods. For example, `.withState()` initializes PACK's document state module\n * and adds the typed `app.state` accessor.\n *\n * @example\n * ```typescript\n * import { DocSchema } from '@my-app/schema';\n *\n * const app = initPackApp(client, {\n * app: { appId: 'your-app-id' },\n * ontologyRid: 'your-ontology-rid',\n * })\n * .withState()\n * .build();\n *\n * const docRef = app.state.createDocRef('your-document-id', DocSchema);\n * const doc = await docRef.getSnapshot(); // get pojo of your doc state.\n * ```\n */\n\n/**\n * Module configuration - either a tuple of [ModuleKey, config] or just a ModuleKey (for modules with no config)\n */\n\n/**\n * Type guard to check if a ModuleConfig is a tuple configuration\n */\nexport const isModuleConfigTuple = config => {\n return Array.isArray(config);\n};\n\n/**\n * To simplify the public type interface on methods taking a PackApp,\n * this function asserts that the implementation is in fact a PackAppInternal\n * implementation, which allows internal module access and perhaps other\n * private functionality in the future.\n */\n\nexport function assertIsAppInternal(app) {\n !(\"getModule\" in app) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"App is not an PackAppInternal\") : invariant(false) : void 0;\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\n/**\n * Assert that a value type is never, useful for compile time exhaustiveness checking.\n *\n * If it is hit at runtime, it may indicate a bug in the code, or an unhandled case\n * for a new value added to a remotely loaded type.\n */\nexport function assertNever(_x) {\n throw new Error(\"Hit unreachable code\");\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\n/**\n * Generates a random ID using crypto library.\n * @param bytes Generate an ID with this many random bytes (default: 12)\n * @returns A hexadecimal string representation of the generated ID\n */\nexport function generateId(bytes = 12) {\n const array = new Int8Array(bytes);\n const r = crypto.getRandomValues(array);\n return toHexString(r);\n}\nfunction toHexString(byteArray) {\n return Array.from(byteArray, function (byte) {\n const h = (byte & 0xff).toString(16);\n return h.length === 1 ? `0${h}` : h;\n }).join(\"\");\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 async function getOntologyRid(app) {\n return app.config.ontologyRid;\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\nconst SEEN_KEYS = new Set();\n\n/**\n * Used to call fn only once between app reloads.\n * eg: Useful for logging warnings that should only be logged once.\n *\n * @example\n * ```ts\n * justOnce(\"unexpected-value\", () => console.warn(\"There was an unexpected value returned\", {value}));\n * ```\n */\nexport function justOnce(key, fn) {\n if (!SEEN_KEYS.has(key)) {\n SEEN_KEYS.add(key);\n fn();\n }\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\n/**\n * Parse JWT token payload without verification.\n * This does NOT verify the token signature - it only extracts payload data.\n * Use only for non-security-critical operations like testing or logging.\n *\n * @param token - JWT token string\n * @returns Parsed payload object\n * @throws Error if token format is invalid\n */\nexport function parseJwtPayload(token) {\n const parts = token.split(\".\");\n if (parts.length !== 3 || !parts[1]) {\n throw new Error(\"Invalid JWT token format\");\n }\n return JSON.parse(atob(parts[1]));\n}"]}
@@ -3,23 +3,22 @@ import type { ModuleKey } from "./ModuleKey.js";
3
3
  /**
4
4
  * PackApp provides access to various pack subsystems.
5
5
  *
6
- * Specific modules are available after configuration and through declarations mixed in by import.
7
- * Eg for state system, if you import @palantir/pack.state.core you will have access to `app.state` accessor.
8
- * Similarly, auth is added automatically by initPackApp.
6
+ * `initPackApp` automatically initializes auth and adds `app.auth`. Optional modules are added
7
+ * through builder methods. For example, `.withState()` initializes PACK's document state module
8
+ * and adds the typed `app.state` accessor.
9
9
  *
10
10
  * @example
11
11
  * ```typescript
12
- * import { DocumentRef } from '@palantir/pack.state.core';
13
12
  * import { DocSchema } from '@my-app/schema';
14
13
  *
15
- * const app = initPackApp({
16
- * tokenProvider: () => 'your-token',
17
- * moduleConfigs: {
18
- * ...createPackDocumentServiceConfig({appId: 'your-app-id', documentType: 'your-document-type'})
19
- * },
20
- * });
14
+ * const app = initPackApp(client, {
15
+ * app: { appId: 'your-app-id' },
16
+ * ontologyRid: 'your-ontology-rid',
17
+ * })
18
+ * .withState()
19
+ * .build();
21
20
  *
22
- * const docRef = app.state.createDocRef(docSchema, 'your-document-id');
21
+ * const docRef = app.state.createDocRef('your-document-id', DocSchema);
23
22
  * const doc = await docRef.getSnapshot(); // get pojo of your doc state.
24
23
  * ```
25
24
  */
@@ -1 +1 @@
1
- {"mappings":"AAiBA,cAAc,iBAAiB;AAC/B,cAAc,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;AAyB/B,iBAAiB,QAAQ;UACd,QAAQ;;;;;AAOnB,YAAY,kBAAkB,yBAAyB,UAAU;AACjE,YAAY,aAAa,eAAe,kBAAkB,KAAK,UAAU;;;;AAKzE,OAAO,cAAM,sBACX,QAAQ,iBACP,oBAAoB;AAIvB,iBAAiB,gBAAgB;UACtB,QAAQ;;;;CAMjB;EAAU;EAAG;GAAqB,WAAW,UAAU,GAAG,WAAW;;;;;;;;AASvE,OAAO,iBAAS,oBAAoB,KAAK,kBAAkB,OAAO,UAAU;AAC5E,OAAO,iBAAS,oBACd,KAAK,0BACI,OAAO","names":[],"sources":["../../../src/types/PackApp.ts"],"version":3,"file":"PackApp.d.ts"}
1
+ {"mappings":"AAiBA,cAAc,iBAAiB;AAC/B,cAAc,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;AAwB/B,iBAAiB,QAAQ;UACd,QAAQ;;;;;AAOnB,YAAY,kBAAkB,yBAAyB,UAAU;AACjE,YAAY,aAAa,eAAe,kBAAkB,KAAK,UAAU;;;;AAKzE,OAAO,cAAM,sBACX,QAAQ,iBACP,oBAAoB;AAIvB,iBAAiB,gBAAgB;UACtB,QAAQ;;;;CAMjB;EAAU;EAAG;GAAqB,WAAW,UAAU,GAAG,WAAW;;;;;;;;AASvE,OAAO,iBAAS,oBAAoB,KAAK,kBAAkB,OAAO,UAAU;AAC5E,OAAO,iBAAS,oBACd,KAAK,0BACI,OAAO","names":[],"sources":["../../../src/types/PackApp.ts"],"version":3,"file":"PackApp.d.ts"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@palantir/pack.core",
3
- "version": "0.27.0",
3
+ "version": "0.28.0",
4
4
  "description": "PACK Core functionality and utilities",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -21,23 +21,22 @@ import type { ModuleKey } from "./ModuleKey.js";
21
21
  /**
22
22
  * PackApp provides access to various pack subsystems.
23
23
  *
24
- * Specific modules are available after configuration and through declarations mixed in by import.
25
- * Eg for state system, if you import @palantir/pack.state.core you will have access to `app.state` accessor.
26
- * Similarly, auth is added automatically by initPackApp.
24
+ * `initPackApp` automatically initializes auth and adds `app.auth`. Optional modules are added
25
+ * through builder methods. For example, `.withState()` initializes PACK's document state module
26
+ * and adds the typed `app.state` accessor.
27
27
  *
28
28
  * @example
29
29
  * ```typescript
30
- * import { DocumentRef } from '@palantir/pack.state.core';
31
30
  * import { DocSchema } from '@my-app/schema';
32
31
  *
33
- * const app = initPackApp({
34
- * tokenProvider: () => 'your-token',
35
- * moduleConfigs: {
36
- * ...createPackDocumentServiceConfig({appId: 'your-app-id', documentType: 'your-document-type'})
37
- * },
38
- * });
32
+ * const app = initPackApp(client, {
33
+ * app: { appId: 'your-app-id' },
34
+ * ontologyRid: 'your-ontology-rid',
35
+ * })
36
+ * .withState()
37
+ * .build();
39
38
  *
40
- * const docRef = app.state.createDocRef(docSchema, 'your-document-id');
39
+ * const docRef = app.state.createDocRef('your-document-id', DocSchema);
41
40
  * const doc = await docRef.getSnapshot(); // get pojo of your doc state.
42
41
  * ```
43
42
  */