@itwin/ecschema-rpcinterface-tests 5.3.0-dev.3 → 5.3.0-dev.5
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/lib/backend/BackendInit.js.map +1 -1
- package/lib/common/Settings.js +4 -4
- package/lib/common/Settings.js.map +1 -1
- package/lib/common/SideChannels.js.map +1 -1
- package/lib/dist/bundled-tests.js +71 -45
- package/lib/dist/bundled-tests.js.map +1 -1
- package/lib/frontend/SchemaRpcInterface.test.js.map +1 -1
- package/lib/frontend/setup/IModelSession.js.map +1 -1
- package/lib/frontend/setup/TestContext.js.map +1 -1
- package/package.json +16 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackendInit.js","sourceRoot":"","sources":["../../src/backend/BackendInit.ts"],"names":[],"mappings":";;AAAA;;;+FAG+F;AAC/F,yBAAyB;AACzB,6BAA6B;AAC7B,yEAAyE;AACzE,8DAA4D;AAC5D,yDAAgE;AAEhE,sDAAsD;AACtD,SAAS,OAAO,CAAC,OAAe;IAC9B,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC;QACzB,OAAO;IAET,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,4DAA4D;IAC9F,MAAM,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,4DAA4D;IAC3G,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IACnD,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC;QACpB,MAAM,SAAS,CAAC,KAAK,CAAC;IACxB,CAAC;IAED,YAAY,CAAC,SAAS,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,CAAC,KAAK,IAAI,EAAE;IAC3B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAClD,IAAA,qCAAsB,GAAE,CAAC;AAC3B,CAAC,CAAC,EAAE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport * as fs from \"fs\";\nimport * as path from \"path\";\n// Sets up certa to allow a method on the frontend to get an access token\nimport \"@itwin/oidc-signin-tool/lib/cjs/certa/certaBackend\";\nimport { exposeBackendCallbacks } from \"../common/SideChannels\";\n\n/** Loads the provided `.env` file into process.env */\nfunction loadEnv(envFile: string) {\n if (!fs.existsSync(envFile))\n return;\n\n const dotenv = require(\"dotenv\"); // eslint-disable-line @typescript-eslint/no-require-imports\n const dotenvExpand = require(\"dotenv-expand\"); // eslint-disable-line @typescript-eslint/no-require-imports\n const envResult = dotenv.config({ path: envFile });\n if (envResult.error) {\n throw envResult.error;\n }\n\n dotenvExpand(envResult);\n}\n\nmodule.exports = (async () => {\n loadEnv(path.join(__dirname, \"..\", \"..\", \".env\"));\n exposeBackendCallbacks();\n})();\n"]}
|
|
1
|
+
{"version":3,"file":"BackendInit.js","sourceRoot":"","sources":["../../src/backend/BackendInit.ts"],"names":[],"mappings":";;AAAA;;;+FAG+F;AAC/F,yBAAyB;AACzB,6BAA6B;AAC7B,yEAAyE;AACzE,8DAA4D;AAC5D,yDAAgE;AAEhE,sDAAsD;AACtD,SAAS,OAAO,CAAC,OAAe;IAC9B,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC;QACzB,OAAO;IAET,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,4DAA4D;IAC9F,MAAM,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,4DAA4D;IAC3G,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;IACnD,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC;QACpB,MAAM,SAAS,CAAC,KAAK,CAAC;IACxB,CAAC;IAED,YAAY,CAAC,SAAS,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,CAAC,KAAK,IAAI,EAAE;IAC3B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAClD,IAAA,qCAAsB,GAAE,CAAC;AAC3B,CAAC,CAAC,EAAE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport * as fs from \"fs\";\r\nimport * as path from \"path\";\r\n// Sets up certa to allow a method on the frontend to get an access token\r\nimport \"@itwin/oidc-signin-tool/lib/cjs/certa/certaBackend\";\r\nimport { exposeBackendCallbacks } from \"../common/SideChannels\";\r\n\r\n/** Loads the provided `.env` file into process.env */\r\nfunction loadEnv(envFile: string) {\r\n if (!fs.existsSync(envFile))\r\n return;\r\n\r\n const dotenv = require(\"dotenv\"); // eslint-disable-line @typescript-eslint/no-require-imports\r\n const dotenvExpand = require(\"dotenv-expand\"); // eslint-disable-line @typescript-eslint/no-require-imports\r\n const envResult = dotenv.config({ path: envFile });\r\n if (envResult.error) {\r\n throw envResult.error;\r\n }\r\n\r\n dotenvExpand(envResult);\r\n}\r\n\r\nmodule.exports = (async () => {\r\n loadEnv(path.join(__dirname, \"..\", \"..\", \".env\"));\r\n exposeBackendCallbacks();\r\n})();\r\n"]}
|
package/lib/common/Settings.js
CHANGED
|
@@ -103,10 +103,10 @@ class Settings {
|
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
105
|
toString() {
|
|
106
|
-
return `Configurations:
|
|
107
|
-
oidc client id: ${this.oidcClientId},
|
|
108
|
-
oidc scopes: ${this.oidcScopes},
|
|
109
|
-
applicationId: ${this.gprid},
|
|
106
|
+
return `Configurations:
|
|
107
|
+
oidc client id: ${this.oidcClientId},
|
|
108
|
+
oidc scopes: ${this.oidcScopes},
|
|
109
|
+
applicationId: ${this.gprid},
|
|
110
110
|
log level: ${this.logLevel}`;
|
|
111
111
|
}
|
|
112
112
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Settings.js","sourceRoot":"","sources":["../../src/common/Settings.ts"],"names":[],"mappings":";;;AA0BA,4CAMC;AAhCD;;;+FAG+F;AAC/F,sDAA+C;AAC/C,oDAA4D;AAE5D,sFAA2E;AAmB3E,SAAgB,gBAAgB;IAC9B,MAAM,aAAa,GAAG,EAAE,CAAC;IACzB,aAAa,CAAC,IAAI,CAAC,oCAAsB,CAAC,CAAC;IAC3C,aAAa,CAAC,IAAI,CAAC,mDAAoB,CAAC,CAAC;IAEzC,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,MAAa,QAAQ;IACX,QAAQ,GAAY,EAAa,CAAC;IACnC,YAAY,CAAU;IACtB,UAAU,CAAU;IACpB,YAAY,CAAU;IACtB,aAAa,CAAU;IACvB,SAAS,CAAU;IACnB,KAAK,CAAU;IACf,QAAQ,CAAU;IAClB,KAAK,GAA0B,EAAE,CAAC;IAEzC,gEAAgE;IAChE,IAAW,OAAO,KAAc,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IACvD,IAAW,IAAI,KAA0B,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEzD,MAAM,GAAe,EAAgB,CAAC;IAE7C,YAAY,GAAsB;QAChC,MAAM,UAAU,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,WAAW,CAAC,CAAC;QACtD,IAAI,CAAC,UAAU,IAAI,SAAS,KAAK,GAAG,CAAC,QAAQ,EAAE,CAAC;YAC9C,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC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,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,SAAS,KAAK,uBAAQ,CAAC,KAAK,CAAC;gBAChD,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QAC1B,CAAC;QAED,mBAAmB;QACnB,IAAI,SAAS,KAAK,OAAO,CAAC,GAAG,CAAC,gBAAgB;YAC5C,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;QAC7D,IAAI,CAAC,QAAQ,CAAC,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;QAEtD,IAAI,SAAS,KAAK,OAAO,CAAC,GAAG,CAAC,eAAe;YAC3C,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;QAC5D,IAAI,CAAC,QAAQ,CAAC,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;QAEpD,IAAI,SAAS,KAAK,OAAO,CAAC,GAAG,CAAC,YAAY;YACxC,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACzD,IAAI,CAAC,QAAQ,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;QAE9C,YAAY;QACZ,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;YACd,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,EAAE;YAClD,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,EAAE;SACtD,CAAC,CAAC;IACL,CAAC;IAEM,QAAQ;QACb,OAAO;wBACa,IAAI,CAAC,YAAY;qBACpB,IAAI,CAAC,UAAU;uBACb,IAAI,CAAC,KAAK;mBACd,IAAI,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC;CACF;AAlHD,4BAkHC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { LogLevel } from \"@itwin/core-bentley\";\nimport { IModelReadRpcInterface } from \"@itwin/core-common\";\nimport { TestUserCredentials } from \"@itwin/oidc-signin-tool\";\nimport { ECSchemaRpcInterface } from \"@itwin/ecschema-rpcinterface-common\";\n\nexport interface Backend {\n version: string;\n location: string;\n name: string;\n path: string;\n}\n\nexport interface IModelData {\n useName: boolean; // Defines whether or not to use the name of the iModel\n id?: string; // The iModel Id - This is not required\n name?: string; // The name is not required to actually get the iModel, only the id.\n useITwinName: boolean;\n iTwinId?: string;\n iTwinName?: string;\n changesetId?: string;\n}\n\nexport function getRpcInterfaces() {\n const rpcInterfaces = [];\n rpcInterfaces.push(IModelReadRpcInterface);\n rpcInterfaces.push(ECSchemaRpcInterface);\n\n return rpcInterfaces;\n}\n\nexport class Settings {\n private _backend: Backend = {} as Backend;\n public oidcClientId!: string;\n public oidcScopes!: string;\n public oidcRedirect!: string;\n public oidcAuthority?: string;\n public discovery!: string;\n public gprid?: string;\n public logLevel?: number;\n public users: TestUserCredentials[] = [];\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n public get Backend(): Backend { return this._backend; }\n public get user(): TestUserCredentials { return this.users[0]; }\n\n public iModel: IModelData = {} as IModelData;\n\n constructor(env: NodeJS.ProcessEnv) {\n const isFrontend = (typeof (process) === \"undefined\");\n if (!isFrontend && undefined === env.TF_BUILD) {\n const path = require(\"path\"); // eslint-disable-line @typescript-eslint/no-require-imports\n const dotenv = require(\"dotenv\"); // eslint-disable-line @typescript-eslint/no-require-imports\n const dotenvExpand = require(\"dotenv-expand\"); // eslint-disable-line @typescript-eslint/no-require-imports\n // First check in process.cwd() for the config\n let result = dotenv.config();\n if (result.error) {\n const potential = path.resolve(process.cwd(), \"..\", \"..\", \"..\", \"imodeljs-config\", \".env\");\n result = dotenv.config({ path: potential });\n if (result.error)\n throw result.error;\n }\n\n dotenvExpand(result);\n }\n\n if (isFrontend)\n globalThis.process = { browser: true, env } as any;\n\n // Loads the config out of the environment.\n this.load();\n }\n\n /** Loads the necessary variables from `process.env`.\n */\n private load() {\n // Parse OIDC\n if (undefined === process.env.OIDC_CLIENT_ID)\n throw new Error(\"Missing the 'OIDC_CLIENT_ID' setting.\");\n this.oidcClientId = process.env.OIDC_CLIENT_ID!;\n\n if (undefined === process.env.OIDC_SCOPES)\n throw new Error(\"Missing the 'OIDC_SCOPES' setting\");\n this.oidcScopes = process.env.OIDC_SCOPES;\n\n if (process.env.OIDC_AUTHORITY)\n this.oidcAuthority = process.env.OIDC_AUTHORITY;\n\n this.oidcRedirect = (undefined === process.env.OIDC_REDIRECT) ? \"http://localhost:5000\" : process.env.OIDC_REDIRECT;\n\n // Parse GPRId\n if (undefined !== process.env.GPRID)\n this.gprid = process.env.GPRID;\n\n // Parse the iModel variables\n if (!process.env.IMODEL_PROJECTID && !process.env.IMODEL_PROJECTNAME)\n throw new Error(\"Missing the 'IMODEL_PROJECTID' or 'IMODEL_PROJECTNAME' setting.\");\n\n if (!process.env.IMODEL_IMODELID && !process.env.IMODEL_IMODELNAME)\n throw new Error(\"Missing the 'IMODEL_IMODELID' or 'IMODEL_IMODELNAME' setting.\");\n\n this.iModel = {\n useName: !process.env.IMODEL_IMODELID,\n id: process.env.IMODEL_IMODELID,\n name: process.env.IMODEL_IMODELNAME,\n useITwinName: !process.env.IMODEL_PROJECTID,\n iTwinId: process.env.IMODEL_PROJECTID,\n iTwinName: process.env.IMODEL_PROJECTNAME,\n changesetId: process.env.IMODEL_CHANGESETID,\n };\n\n // Parse logging level\n if (undefined !== process.env.LOG_LEVEL) {\n const level = parseInt(process.env.LOG_LEVEL, 10);\n if (!isNaN(level) && undefined !== LogLevel[level])\n this.logLevel = level;\n }\n\n // Get backend data\n if (undefined === process.env.BACKEND_LOCATION)\n throw new Error(\"Missing the 'BACKEND_LOCATION' setting.\");\n this._backend.location = process.env.BACKEND_LOCATION;\n\n if (undefined === process.env.BACKEND_VERSION)\n throw new Error(\"Missing the 'BACKEND_VERSION' setting.\");\n this._backend.version = process.env.BACKEND_VERSION;\n\n if (undefined === process.env.BACKEND_NAME)\n throw new Error(\"Missing the 'BACKEND_NAME' setting.\");\n this._backend.name = process.env.BACKEND_NAME;\n\n // Get users\n this.users.push({\n email: process.env.USER_WITH_ACCESS_USERNAME || \"\",\n password: process.env.USER_WITH_ACCESS_PASSWORD || \"\",\n });\n }\n\n public toString(): string {\n return `Configurations:\n oidc client id: ${this.oidcClientId},\n oidc scopes: ${this.oidcScopes},\n applicationId: ${this.gprid},\n log level: ${this.logLevel}`;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Settings.js","sourceRoot":"","sources":["../../src/common/Settings.ts"],"names":[],"mappings":";;;AA0BA,4CAMC;AAhCD;;;+FAG+F;AAC/F,sDAA+C;AAC/C,oDAA4D;AAE5D,sFAA2E;AAmB3E,SAAgB,gBAAgB;IAC9B,MAAM,aAAa,GAAG,EAAE,CAAC;IACzB,aAAa,CAAC,IAAI,CAAC,oCAAsB,CAAC,CAAC;IAC3C,aAAa,CAAC,IAAI,CAAC,mDAAoB,CAAC,CAAC;IAEzC,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,MAAa,QAAQ;IACX,QAAQ,GAAY,EAAa,CAAC;IACnC,YAAY,CAAU;IACtB,UAAU,CAAU;IACpB,YAAY,CAAU;IACtB,aAAa,CAAU;IACvB,SAAS,CAAU;IACnB,KAAK,CAAU;IACf,QAAQ,CAAU;IAClB,KAAK,GAA0B,EAAE,CAAC;IAEzC,gEAAgE;IAChE,IAAW,OAAO,KAAc,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IACvD,IAAW,IAAI,KAA0B,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEzD,MAAM,GAAe,EAAgB,CAAC;IAE7C,YAAY,GAAsB;QAChC,MAAM,UAAU,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,WAAW,CAAC,CAAC;QACtD,IAAI,CAAC,UAAU,IAAI,SAAS,KAAK,GAAG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K,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;YAClD,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,SAAS,KAAK,uBAAQ,CAAC,KAAK,CAAC;gBAChD,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QAC1B,CAAC;QAED,mBAAmB;QACnB,IAAI,SAAS,KAAK,OAAO,CAAC,GAAG,CAAC,gBAAgB;YAC5C,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;QAC7D,IAAI,CAAC,QAAQ,CAAC,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;QAEtD,IAAI,SAAS,KAAK,OAAO,CAAC,GAAG,CAAC,eAAe;YAC3C,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;QAC5D,IAAI,CAAC,QAAQ,CAAC,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;QAEpD,IAAI,SAAS,KAAK,OAAO,CAAC,GAAG,CAAC,YAAY;YACxC,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACzD,IAAI,CAAC,QAAQ,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;QAE9C,YAAY;QACZ,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;YACd,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,EAAE;YAClD,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,EAAE;SACtD,CAAC,CAAC;IACL,CAAC;IAEM,QAAQ;QACb,OAAO;wBACa,IAAI,CAAC,YAAY;qBACpB,IAAI,CAAC,UAAU;uBACb,IAAI,CAAC,KAAK;mBACd,IAAI,CAAC,QAAQ,EAAE,CAAC;IACjC,CAAC;CACF;AAlHD,4BAkHC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { LogLevel } from \"@itwin/core-bentley\";\r\nimport { IModelReadRpcInterface } from \"@itwin/core-common\";\r\nimport { TestUserCredentials } from \"@itwin/oidc-signin-tool\";\r\nimport { ECSchemaRpcInterface } from \"@itwin/ecschema-rpcinterface-common\";\r\n\r\nexport interface Backend {\r\n version: string;\r\n location: string;\r\n name: string;\r\n path: string;\r\n}\r\n\r\nexport interface IModelData {\r\n useName: boolean; // Defines whether or not to use the name of the iModel\r\n id?: string; // The iModel Id - This is not required\r\n name?: string; // The name is not required to actually get the iModel, only the id.\r\n useITwinName: boolean;\r\n iTwinId?: string;\r\n iTwinName?: string;\r\n changesetId?: string;\r\n}\r\n\r\nexport function getRpcInterfaces() {\r\n const rpcInterfaces = [];\r\n rpcInterfaces.push(IModelReadRpcInterface);\r\n rpcInterfaces.push(ECSchemaRpcInterface);\r\n\r\n return rpcInterfaces;\r\n}\r\n\r\nexport class Settings {\r\n private _backend: Backend = {} as Backend;\r\n public oidcClientId!: string;\r\n public oidcScopes!: string;\r\n public oidcRedirect!: string;\r\n public oidcAuthority?: string;\r\n public discovery!: string;\r\n public gprid?: string;\r\n public logLevel?: number;\r\n public users: TestUserCredentials[] = [];\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public get Backend(): Backend { return this._backend; }\r\n public get user(): TestUserCredentials { return this.users[0]; }\r\n\r\n public iModel: IModelData = {} as IModelData;\r\n\r\n constructor(env: NodeJS.ProcessEnv) {\r\n const isFrontend = (typeof (process) === \"undefined\");\r\n if (!isFrontend && undefined === env.TF_BUILD) {\r\n const path = require(\"path\"); // eslint-disable-line @typescript-eslint/no-require-imports\r\n const dotenv = require(\"dotenv\"); // eslint-disable-line @typescript-eslint/no-require-imports\r\n const dotenvExpand = require(\"dotenv-expand\"); // eslint-disable-line @typescript-eslint/no-require-imports\r\n // First check in process.cwd() for the config\r\n let result = dotenv.config();\r\n if (result.error) {\r\n const potential = path.resolve(process.cwd(), \"..\", \"..\", \"..\", \"imodeljs-config\", \".env\");\r\n result = dotenv.config({ path: potential });\r\n if (result.error)\r\n throw result.error;\r\n }\r\n\r\n dotenvExpand(result);\r\n }\r\n\r\n if (isFrontend)\r\n globalThis.process = { browser: true, env } as any;\r\n\r\n // Loads the config out of the environment.\r\n this.load();\r\n }\r\n\r\n /** Loads the necessary variables from `process.env`.\r\n */\r\n private load() {\r\n // Parse OIDC\r\n if (undefined === process.env.OIDC_CLIENT_ID)\r\n throw new Error(\"Missing the 'OIDC_CLIENT_ID' setting.\");\r\n this.oidcClientId = process.env.OIDC_CLIENT_ID!;\r\n\r\n if (undefined === process.env.OIDC_SCOPES)\r\n throw new Error(\"Missing the 'OIDC_SCOPES' setting\");\r\n this.oidcScopes = process.env.OIDC_SCOPES;\r\n\r\n if (process.env.OIDC_AUTHORITY)\r\n this.oidcAuthority = process.env.OIDC_AUTHORITY;\r\n\r\n this.oidcRedirect = (undefined === process.env.OIDC_REDIRECT) ? \"http://localhost:5000\" : process.env.OIDC_REDIRECT;\r\n\r\n // Parse GPRId\r\n if (undefined !== process.env.GPRID)\r\n this.gprid = process.env.GPRID;\r\n\r\n // Parse the iModel variables\r\n if (!process.env.IMODEL_PROJECTID && !process.env.IMODEL_PROJECTNAME)\r\n throw new Error(\"Missing the 'IMODEL_PROJECTID' or 'IMODEL_PROJECTNAME' setting.\");\r\n\r\n if (!process.env.IMODEL_IMODELID && !process.env.IMODEL_IMODELNAME)\r\n throw new Error(\"Missing the 'IMODEL_IMODELID' or 'IMODEL_IMODELNAME' setting.\");\r\n\r\n this.iModel = {\r\n useName: !process.env.IMODEL_IMODELID,\r\n id: process.env.IMODEL_IMODELID,\r\n name: process.env.IMODEL_IMODELNAME,\r\n useITwinName: !process.env.IMODEL_PROJECTID,\r\n iTwinId: process.env.IMODEL_PROJECTID,\r\n iTwinName: process.env.IMODEL_PROJECTNAME,\r\n changesetId: process.env.IMODEL_CHANGESETID,\r\n };\r\n\r\n // Parse logging level\r\n if (undefined !== process.env.LOG_LEVEL) {\r\n const level = parseInt(process.env.LOG_LEVEL, 10);\r\n if (!isNaN(level) && undefined !== LogLevel[level])\r\n this.logLevel = level;\r\n }\r\n\r\n // Get backend data\r\n if (undefined === process.env.BACKEND_LOCATION)\r\n throw new Error(\"Missing the 'BACKEND_LOCATION' setting.\");\r\n this._backend.location = process.env.BACKEND_LOCATION;\r\n\r\n if (undefined === process.env.BACKEND_VERSION)\r\n throw new Error(\"Missing the 'BACKEND_VERSION' setting.\");\r\n this._backend.version = process.env.BACKEND_VERSION;\r\n\r\n if (undefined === process.env.BACKEND_NAME)\r\n throw new Error(\"Missing the 'BACKEND_NAME' setting.\");\r\n this._backend.name = process.env.BACKEND_NAME;\r\n\r\n // Get users\r\n this.users.push({\r\n email: process.env.USER_WITH_ACCESS_USERNAME || \"\",\r\n password: process.env.USER_WITH_ACCESS_PASSWORD || \"\",\r\n });\r\n }\r\n\r\n public toString(): string {\r\n return `Configurations:\r\n oidc client id: ${this.oidcClientId},\r\n oidc scopes: ${this.oidcScopes},\r\n applicationId: ${this.gprid},\r\n log level: ${this.logLevel}`;\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SideChannels.js","sourceRoot":"","sources":["../../src/common/SideChannels.ts"],"names":[],"mappings":";;AAQA,wDAIC;AAED,4DAEC;AAhBD;;;+FAG+F;AAC/F,wEAAuG;AAEvG,MAAM,kBAAkB,GAAG,QAAQ,CAAC;AAEpC,SAAgB,sBAAsB;IACpC,IAAA,uCAAuB,EAAC,kBAAkB,EAAE,GAAG,EAAE;QAC/C,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;AACL,CAAC;AAEM,KAAK,UAAU,wBAAwB;IAC5C,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,IAAA,sCAAsB,EAAC,kBAAkB,CAAC,CAAC,CAAC;AACtE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { executeBackendCallback, registerBackendCallback } from \"@itwin/certa/lib/utils/CallbackUtils\";\n\nconst getEnvCallbackName = \"getEnv\";\n\nexport function exposeBackendCallbacks() {\n registerBackendCallback(getEnvCallbackName, () => {\n return JSON.stringify(process.env);\n });\n}\n\nexport async function getProcessEnvFromBackend(): Promise<NodeJS.ProcessEnv> {\n return JSON.parse(await executeBackendCallback(getEnvCallbackName));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SideChannels.js","sourceRoot":"","sources":["../../src/common/SideChannels.ts"],"names":[],"mappings":";;AAQA,wDAIC;AAED,4DAEC;AAhBD;;;+FAG+F;AAC/F,wEAAuG;AAEvG,MAAM,kBAAkB,GAAG,QAAQ,CAAC;AAEpC,SAAgB,sBAAsB;IACpC,IAAA,uCAAuB,EAAC,kBAAkB,EAAE,GAAG,EAAE;QAC/C,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;AACL,CAAC;AAEM,KAAK,UAAU,wBAAwB;IAC5C,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,IAAA,sCAAsB,EAAC,kBAAkB,CAAC,CAAC,CAAC;AACtE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { executeBackendCallback, registerBackendCallback } from \"@itwin/certa/lib/utils/CallbackUtils\";\r\n\r\nconst getEnvCallbackName = \"getEnv\";\r\n\r\nexport function exposeBackendCallbacks() {\r\n registerBackendCallback(getEnvCallbackName, () => {\r\n return JSON.stringify(process.env);\r\n });\r\n}\r\n\r\nexport async function getProcessEnvFromBackend(): Promise<NodeJS.ProcessEnv> {\r\n return JSON.parse(await executeBackendCallback(getEnvCallbackName));\r\n}\r\n"]}
|
|
@@ -155663,10 +155663,14 @@ class StandardQuantityTypeDefinition {
|
|
|
155663
155663
|
*/
|
|
155664
155664
|
class QuantityTypeFormatsProvider {
|
|
155665
155665
|
onFormatsChanged = new _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.BeEvent();
|
|
155666
|
+
_removeListeners = [];
|
|
155666
155667
|
constructor() {
|
|
155667
|
-
_IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.addListener(() => {
|
|
155668
|
+
this._removeListeners.push(_IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.addListener(() => {
|
|
155668
155669
|
this.onFormatsChanged.raiseEvent({ formatsChanged: "all" });
|
|
155669
|
-
});
|
|
155670
|
+
}));
|
|
155671
|
+
}
|
|
155672
|
+
[Symbol.dispose]() {
|
|
155673
|
+
this._removeListeners.forEach(listener => listener());
|
|
155670
155674
|
}
|
|
155671
155675
|
_kindOfQuantityMap = new Map([
|
|
155672
155676
|
["AecUnits.LENGTH", QuantityType.Length],
|
|
@@ -305308,8 +305312,8 @@ class Formatter {
|
|
|
305308
305312
|
*/
|
|
305309
305313
|
static formatComposite(magnitude, spec) {
|
|
305310
305314
|
const compositeStrings = [];
|
|
305311
|
-
|
|
305312
|
-
let
|
|
305315
|
+
let isNegative = false;
|
|
305316
|
+
let remainingMagnitude = magnitude;
|
|
305313
305317
|
for (let i = 0; i < spec.unitConversions.length; i++) {
|
|
305314
305318
|
const currentLabel = spec.unitConversions[i].label;
|
|
305315
305319
|
const unitConversion = spec.unitConversions[i].conversion;
|
|
@@ -305319,40 +305323,43 @@ class Formatter {
|
|
|
305319
305323
|
throw new _Exception__WEBPACK_IMPORTED_MODULE_1__.QuantityError(_Exception__WEBPACK_IMPORTED_MODULE_1__.QuantityStatus.InvalidCompositeFormat, `The Format ${spec.format.name} has a invalid unit specification.`);
|
|
305320
305324
|
let unitValue = 0.0;
|
|
305321
305325
|
if (spec.format.type === _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatType.Ratio) {
|
|
305322
|
-
if (1 !== spec.format.units
|
|
305326
|
+
if (1 !== (spec.format.units?.length ?? 0))
|
|
305323
305327
|
throw new _Exception__WEBPACK_IMPORTED_MODULE_1__.QuantityError(_Exception__WEBPACK_IMPORTED_MODULE_1__.QuantityStatus.InvalidCompositeFormat, `The Format '${spec.format.name}' with type 'ratio' must have exactly one unit.`);
|
|
305324
305328
|
try {
|
|
305325
|
-
unitValue = (0,_Quantity__WEBPACK_IMPORTED_MODULE_3__.applyConversion)(
|
|
305329
|
+
unitValue = (0,_Quantity__WEBPACK_IMPORTED_MODULE_3__.applyConversion)(remainingMagnitude, unitConversion) + this.FPV_MINTHRESHOLD;
|
|
305326
305330
|
}
|
|
305327
305331
|
catch (e) {
|
|
305328
305332
|
// The "InvertingZero" error is thrown when the value is zero and the conversion factor is inverted.
|
|
305329
305333
|
// For ratio, we actually want to support this corner case and return "1:0" as the formatted value.
|
|
305330
305334
|
if (e instanceof _Exception__WEBPACK_IMPORTED_MODULE_1__.QuantityError && e.errorNumber === _Exception__WEBPACK_IMPORTED_MODULE_1__.QuantityStatus.InvertingZero) {
|
|
305331
|
-
return "1:0";
|
|
305335
|
+
return { componentText: "1:0", isNegative: false };
|
|
305332
305336
|
}
|
|
305333
305337
|
}
|
|
305334
305338
|
compositeStrings.push(this.formatRatio(unitValue, spec));
|
|
305339
|
+
isNegative = unitValue < 0;
|
|
305335
305340
|
continue;
|
|
305336
305341
|
}
|
|
305337
|
-
unitValue = (0,_Quantity__WEBPACK_IMPORTED_MODULE_3__.applyConversion)(
|
|
305342
|
+
unitValue = (0,_Quantity__WEBPACK_IMPORTED_MODULE_3__.applyConversion)(remainingMagnitude, unitConversion) + this.FPV_MINTHRESHOLD;
|
|
305338
305343
|
if (0 === i) {
|
|
305344
|
+
// Only set isNegative from the first (major) unit conversion
|
|
305345
|
+
isNegative = unitValue < 0;
|
|
305339
305346
|
const precisionScale = Math.pow(10, 8); // use a fixed round off precision of 8 to avoid loss of precision in actual magnitude
|
|
305340
305347
|
unitValue = Math.floor(unitValue * precisionScale + FPV_ROUNDFACTOR) / precisionScale;
|
|
305341
305348
|
if ((Math.abs(unitValue) < 0.0001) && spec.format.hasFormatTraitSet(_FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatTraits.ZeroEmpty))
|
|
305342
|
-
return "";
|
|
305349
|
+
return { componentText: "", isNegative: false };
|
|
305343
305350
|
}
|
|
305344
|
-
if (i < spec.format.units
|
|
305345
|
-
const wholePart = Math.
|
|
305346
|
-
const componentText = Formatter.formatCompositePart(wholePart, false, currentLabel, spec);
|
|
305347
|
-
|
|
305351
|
+
if (i < (spec.format.units?.length ?? 0) - 1) {
|
|
305352
|
+
const wholePart = Math.trunc(unitValue);
|
|
305353
|
+
const componentText = Formatter.formatCompositePart(Math.abs(wholePart), false, currentLabel, spec);
|
|
305354
|
+
remainingMagnitude = unitValue - wholePart;
|
|
305348
305355
|
compositeStrings.push(componentText);
|
|
305349
305356
|
}
|
|
305350
305357
|
else {
|
|
305351
|
-
const componentText = Formatter.formatCompositePart(unitValue, true, currentLabel, spec);
|
|
305358
|
+
const componentText = Formatter.formatCompositePart(Math.abs(unitValue), true, currentLabel, spec);
|
|
305352
305359
|
compositeStrings.push(componentText);
|
|
305353
305360
|
}
|
|
305354
305361
|
}
|
|
305355
|
-
return compositeStrings.join(spec.format.spacerOrDefault);
|
|
305362
|
+
return { componentText: compositeStrings.join(spec.format.spacerOrDefault), isNegative };
|
|
305356
305363
|
}
|
|
305357
305364
|
/** Format a quantity value into a single text string. Imitate how formatting done by server method NumericFormatSpec::FormatDouble.
|
|
305358
305365
|
* @param magnitude quantity value
|
|
@@ -305481,45 +305488,58 @@ class Formatter {
|
|
|
305481
305488
|
}
|
|
305482
305489
|
return value;
|
|
305483
305490
|
}
|
|
305484
|
-
/**
|
|
305485
|
-
* @param
|
|
305486
|
-
* @param
|
|
305491
|
+
/** Helper function to apply sign formatting based on showSignOption
|
|
305492
|
+
* @param isNegative whether the value should be treated as negative
|
|
305493
|
+
* @param showSignOption the sign display option
|
|
305494
|
+
* @param formatType the format type (to handle bearing/azimuth exceptions)
|
|
305495
|
+
* @returns object containing prefix and suffix strings
|
|
305487
305496
|
*/
|
|
305488
|
-
static
|
|
305489
|
-
const valueIsNegative = magnitude < 0.0;
|
|
305497
|
+
static applySignFormatting(isNegative, showSignOption, formatType) {
|
|
305490
305498
|
let prefix = "";
|
|
305491
305499
|
let suffix = "";
|
|
305492
|
-
|
|
305493
|
-
if (spec.format.type === _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatType.Bearing || spec.format.type === _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatType.Azimuth) {
|
|
305494
|
-
const result = this.processBearingAndAzimuth(magnitude, spec);
|
|
305495
|
-
magnitude = result.magnitude;
|
|
305496
|
-
prefix = result.prefix ?? "";
|
|
305497
|
-
suffix = result.suffix ?? "";
|
|
305498
|
-
}
|
|
305499
|
-
switch (spec.format.showSignOption) {
|
|
305500
|
+
switch (showSignOption) {
|
|
305500
305501
|
case _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.ShowSignOption.NegativeParentheses:
|
|
305501
|
-
if (
|
|
305502
|
-
prefix
|
|
305503
|
-
suffix =
|
|
305502
|
+
if (isNegative) {
|
|
305503
|
+
prefix = "(";
|
|
305504
|
+
suffix = ")";
|
|
305504
305505
|
}
|
|
305505
305506
|
break;
|
|
305506
305507
|
case _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.ShowSignOption.OnlyNegative:
|
|
305507
|
-
if (
|
|
305508
|
-
prefix
|
|
305508
|
+
if (isNegative && formatType !== _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatType.Bearing && formatType !== _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatType.Azimuth) {
|
|
305509
|
+
prefix = "-";
|
|
305510
|
+
}
|
|
305509
305511
|
break;
|
|
305510
305512
|
case _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.ShowSignOption.SignAlways:
|
|
305511
|
-
|
|
305512
|
-
prefix += "-";
|
|
305513
|
-
else
|
|
305514
|
-
prefix += "+";
|
|
305513
|
+
prefix = isNegative ? "-" : "+";
|
|
305515
305514
|
break;
|
|
305516
305515
|
case _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.ShowSignOption.NoSign:
|
|
305517
305516
|
default:
|
|
305518
305517
|
break;
|
|
305519
305518
|
}
|
|
305519
|
+
return { prefix, suffix };
|
|
305520
|
+
}
|
|
305521
|
+
/** Format a quantity value into a single text string based on the current format specification of this class.
|
|
305522
|
+
* @param magnitude defines the value to spec.format.
|
|
305523
|
+
* @param spec A FormatterSpec object the defines specification for the magnitude and unit conversions for the formatter.
|
|
305524
|
+
*/
|
|
305525
|
+
static formatQuantity(magnitude, spec) {
|
|
305526
|
+
let valueIsNegative = magnitude < 0.0;
|
|
305527
|
+
let prefix = "";
|
|
305528
|
+
let suffix = "";
|
|
305529
|
+
let formattedValue = "";
|
|
305530
|
+
// Handle bearing/azimuth special formatting
|
|
305531
|
+
if (spec.format.type === _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatType.Bearing || spec.format.type === _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatType.Azimuth) {
|
|
305532
|
+
const result = this.processBearingAndAzimuth(magnitude, spec);
|
|
305533
|
+
magnitude = result.magnitude;
|
|
305534
|
+
prefix = result.prefix ?? "";
|
|
305535
|
+
suffix = result.suffix ?? "";
|
|
305536
|
+
}
|
|
305520
305537
|
let formattedMagnitude = "";
|
|
305521
305538
|
if (spec.format.hasUnits) {
|
|
305522
|
-
|
|
305539
|
+
const compositeResult = Formatter.formatComposite(magnitude, spec);
|
|
305540
|
+
formattedMagnitude = compositeResult.componentText;
|
|
305541
|
+
// Override the sign detection with the composite conversion result
|
|
305542
|
+
valueIsNegative = compositeResult.isNegative;
|
|
305523
305543
|
}
|
|
305524
305544
|
else {
|
|
305525
305545
|
// unitless quantity
|
|
@@ -305530,7 +305550,12 @@ class Formatter {
|
|
|
305530
305550
|
else
|
|
305531
305551
|
formattedMagnitude = formattedMagnitude + spec.format.uomSeparator + spec.unitConversions[0].label;
|
|
305532
305552
|
}
|
|
305553
|
+
// For unitless quantities, keep original sign detection
|
|
305533
305554
|
}
|
|
305555
|
+
// Apply sign formatting based on the final determined sign
|
|
305556
|
+
const signFormatting = this.applySignFormatting(valueIsNegative, spec.format.showSignOption, spec.format.type);
|
|
305557
|
+
prefix += signFormatting.prefix;
|
|
305558
|
+
suffix = signFormatting.suffix + suffix;
|
|
305534
305559
|
// add Sign prefix and suffix as necessary
|
|
305535
305560
|
if ((prefix.length > 0 || suffix.length > 0) && formattedMagnitude.length > 0)
|
|
305536
305561
|
formattedValue = prefix + formattedMagnitude + suffix;
|
|
@@ -305551,7 +305576,8 @@ class Formatter {
|
|
|
305551
305576
|
magnitude -= quarterRevolution;
|
|
305552
305577
|
quadrant++;
|
|
305553
305578
|
}
|
|
305554
|
-
let prefix
|
|
305579
|
+
let prefix = "";
|
|
305580
|
+
let suffix = "";
|
|
305555
305581
|
// Quadrants are
|
|
305556
305582
|
// 3 0
|
|
305557
305583
|
// 2 1
|
|
@@ -305578,7 +305604,7 @@ class Formatter {
|
|
|
305578
305604
|
prefix = "N";
|
|
305579
305605
|
}
|
|
305580
305606
|
}
|
|
305581
|
-
return { magnitude, prefix, suffix
|
|
305607
|
+
return { magnitude, prefix, suffix };
|
|
305582
305608
|
}
|
|
305583
305609
|
if (type === _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatType.Azimuth) {
|
|
305584
305610
|
let azimuthBase = 0; // default base is North
|
|
@@ -307779,10 +307805,10 @@ class Settings {
|
|
|
307779
307805
|
});
|
|
307780
307806
|
}
|
|
307781
307807
|
toString() {
|
|
307782
|
-
return `Configurations:
|
|
307783
|
-
oidc client id: ${this.oidcClientId},
|
|
307784
|
-
oidc scopes: ${this.oidcScopes},
|
|
307785
|
-
applicationId: ${this.gprid},
|
|
307808
|
+
return `Configurations:
|
|
307809
|
+
oidc client id: ${this.oidcClientId},
|
|
307810
|
+
oidc scopes: ${this.oidcScopes},
|
|
307811
|
+
applicationId: ${this.gprid},
|
|
307786
307812
|
log level: ${this.logLevel}`;
|
|
307787
307813
|
}
|
|
307788
307814
|
}
|
|
@@ -320726,7 +320752,7 @@ var loadLanguages = instance.loadLanguages;
|
|
|
320726
320752
|
/***/ ((module) => {
|
|
320727
320753
|
|
|
320728
320754
|
"use strict";
|
|
320729
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@itwin/core-frontend","version":"5.3.0-dev.
|
|
320755
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@itwin/core-frontend","version":"5.3.0-dev.5","description":"iTwin.js frontend components","main":"lib/cjs/core-frontend.js","module":"lib/esm/core-frontend.js","typings":"lib/cjs/core-frontend","license":"MIT","scripts":{"build":"npm run -s copy:public && npm run -s build:cjs && npm run -s build:esm && npm run -s webpackWorkers && npm run -s copy:workers && npm run -s copy:draco","build:cjs":"npm run -s copy:js:cjs && tsc 1>&2 --outDir lib/cjs","build:esm":"npm run -s copy:js:esm && tsc 1>&2 --module ES2022 --outDir lib/esm","clean":"rimraf -g lib .rush/temp/package-deps*.json","copy:public":"cpx \\"./src/public/**/*\\" ./lib/public","copy:js:cjs":"cpx \\"./src/**/*.js\\" ./lib/cjs","copy:js:esm":"cpx \\"./src/**/*.js\\" ./lib/esm","copy:workers":"cpx \\"./lib/workers/webpack/parse-imdl-worker.js\\" ./lib/public/scripts","copy:draco":"cpx \\"./node_modules/@loaders.gl/draco/dist/libs/*\\" ./lib/public/scripts","docs":"betools docs --json=../../generated-docs/core/core-frontend/file.json --tsIndexFile=./core-frontend.ts --onlyJson --excludes=webgl/**/*,**/map/*.d.ts,**/tile/*.d.ts,**/*-css.ts","extract-api":"betools extract-api --entry=core-frontend && npm run extract-extension-api","extract-extension-api":"eslint --no-inline-config -c extraction.eslint.config.js \\"./src/**/*.ts\\" 1>&2","lint":"eslint \\"./src/**/*.ts\\" 1>&2","lint-fix":"eslint --fix -f visualstudio \\"./src/**/*.ts\\" 1>&2","lint-deprecation":"eslint --fix -f visualstudio --no-inline-config -c ../../common/config/eslint/eslint.config.deprecation-policy.js \\"./src/**/*.ts\\"","pseudolocalize":"betools pseudolocalize --englishDir ./src/public/locales/en --out ./public/locales/en-PSEUDO","test":"npm run webpackTestWorker && vitest --run","cover":"npm run webpackTestWorker && vitest --run","webpackTests":"webpack --config ./src/test/utils/webpack.config.js 1>&2 && npm run -s webpackTestWorker","webpackTestWorker":"webpack --config ./src/test/worker/webpack.config.js 1>&2 && cpx \\"./lib/test/test-worker.js\\" ./lib/test","webpackWorkers":"webpack --config ./src/workers/ImdlParser/webpack.config.js 1>&2"},"repository":{"type":"git","url":"https://github.com/iTwin/itwinjs-core.git","directory":"core/frontend"},"keywords":["Bentley","BIM","iModel","digital-twin","iTwin"],"author":{"name":"Bentley Systems, Inc.","url":"http://www.bentley.com"},"peerDependencies":{"@itwin/appui-abstract":"workspace:*","@itwin/core-bentley":"workspace:*","@itwin/core-common":"workspace:*","@itwin/core-geometry":"workspace:*","@itwin/core-orbitgt":"workspace:*","@itwin/core-quantity":"workspace:*","@itwin/ecschema-metadata":"workspace:*","@itwin/ecschema-rpcinterface-common":"workspace:*"},"//devDependencies":["NOTE: All peerDependencies should also be listed as devDependencies since peerDependencies are not considered by npm install","NOTE: All tools used by scripts in this package must be listed as devDependencies"],"devDependencies":{"@itwin/appui-abstract":"workspace:*","@itwin/build-tools":"workspace:*","@itwin/core-bentley":"workspace:*","@itwin/core-common":"workspace:*","@itwin/core-geometry":"workspace:*","@itwin/core-orbitgt":"workspace:*","@itwin/core-quantity":"workspace:*","@itwin/ecschema-metadata":"workspace:*","@itwin/ecschema-rpcinterface-common":"workspace:*","@itwin/eslint-plugin":"5.2.2-dev.2","@types/chai-as-promised":"^7","@types/draco3d":"^1.4.10","@types/sinon":"^17.0.2","@vitest/browser":"^3.0.6","@vitest/coverage-v8":"^3.0.6","cpx2":"^8.0.0","eslint":"^9.31.0","glob":"^10.3.12","playwright":"~1.47.1","rimraf":"^6.0.1","sinon":"^17.0.2","source-map-loader":"^5.0.0","typescript":"~5.6.2","typemoq":"^2.1.0","vitest":"^3.0.6","vite-multiple-assets":"^1.3.1","vite-plugin-static-copy":"2.2.0","webpack":"^5.97.1"},"//dependencies":["NOTE: these dependencies should be only for things that DO NOT APPEAR IN THE API","NOTE: core-frontend should remain UI technology agnostic, so no react/angular dependencies are allowed"],"dependencies":{"@itwin/cloud-agnostic-core":"^2.2.4","@itwin/object-storage-core":"^2.3.0","@itwin/core-i18n":"workspace:*","@itwin/webgl-compatibility":"workspace:*","@loaders.gl/core":"^4.3.4","@loaders.gl/draco":"^4.3.4","fuse.js":"^3.3.0","wms-capabilities":"0.4.0"}}');
|
|
320730
320756
|
|
|
320731
320757
|
/***/ })
|
|
320732
320758
|
|