@olympeio-extensions/sql-connector-knex 2.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/import/dcInitConfig.json +1 -0
- package/import/extensions.sql-connector-knex/Home/Olympe/Extensions/Connectors/SQL_Connector_(knex)/.SQL_Connector_(knex).newInst.json +1 -0
- package/import/extensions.sql-connector-knex/Home/Olympe/Extensions/Connectors/SQL_Connector_(knex)/.SQL_Connector_(knex).newRel.json +1 -0
- package/import/extensions.sql-connector-knex/Home/Olympe/Extensions/Connectors/SQL_Connector_(knex)/DB_Delete.newInst.json +1 -0
- package/import/extensions.sql-connector-knex/Home/Olympe/Extensions/Connectors/SQL_Connector_(knex)/DB_Delete.newRel.json +1 -0
- package/import/extensions.sql-connector-knex/Home/Olympe/Extensions/Connectors/SQL_Connector_(knex)/DB_Execute.newInst.json +1 -0
- package/import/extensions.sql-connector-knex/Home/Olympe/Extensions/Connectors/SQL_Connector_(knex)/DB_Execute.newRel.json +1 -0
- package/import/extensions.sql-connector-knex/Home/Olympe/Extensions/Connectors/SQL_Connector_(knex)/DB_Insert.newInst.json +1 -0
- package/import/extensions.sql-connector-knex/Home/Olympe/Extensions/Connectors/SQL_Connector_(knex)/DB_Insert.newRel.json +1 -0
- package/import/extensions.sql-connector-knex/Home/Olympe/Extensions/Connectors/SQL_Connector_(knex)/DB_Select.newInst.json +1 -0
- package/import/extensions.sql-connector-knex/Home/Olympe/Extensions/Connectors/SQL_Connector_(knex)/DB_Select.newRel.json +1 -0
- package/import/extensions.sql-connector-knex/Home/Olympe/Extensions/Connectors/SQL_Connector_(knex)/DB_Update.newInst.json +1 -0
- package/import/extensions.sql-connector-knex/Home/Olympe/Extensions/Connectors/SQL_Connector_(knex)/DB_Update.newRel.json +1 -0
- package/import/extensions.sql-connector-knex/Home/Olympe/Extensions/Connectors/SQL_Connector_(knex)/Get_SQL_DB_Config.newInst.json +1 -0
- package/import/extensions.sql-connector-knex/Home/Olympe/Extensions/Connectors/SQL_Connector_(knex)/Get_SQL_DB_Config.newRel.json +1 -0
- package/import/extensions.sql-connector-knex/Home/Olympe/Extensions/Connectors/SQL_Connector_(knex)/New_Coded_Visual_Component.newInst.json +1 -0
- package/import/extensions.sql-connector-knex/Home/Olympe/Extensions/Connectors/SQL_Connector_(knex)/New_Coded_Visual_Component.newRel.json +1 -0
- package/import/extensions.sql-connector-knex/Home/Olympe/Extensions/Connectors/SQL_Connector_(knex)/SQL_Connector_models.newInst.json +1 -0
- package/import/extensions.sql-connector-knex/Home/Olympe/Extensions/Connectors/SQL_Connector_(knex)/SQL_Connector_models.newRel.json +1 -0
- package/import/extensions.sql-connector-knex/Home/Olympe/Extensions/Connectors/SQL_Connector_(knex)/SQL_Delete.newInst.json +1 -0
- package/import/extensions.sql-connector-knex/Home/Olympe/Extensions/Connectors/SQL_Connector_(knex)/SQL_Delete.newRel.json +1 -0
- package/import/extensions.sql-connector-knex/Home/Olympe/Extensions/Connectors/SQL_Connector_(knex)/SQL_Execute.newInst.json +1 -0
- package/import/extensions.sql-connector-knex/Home/Olympe/Extensions/Connectors/SQL_Connector_(knex)/SQL_Execute.newRel.json +1 -0
- package/import/extensions.sql-connector-knex/Home/Olympe/Extensions/Connectors/SQL_Connector_(knex)/SQL_Insert.newInst.json +1 -0
- package/import/extensions.sql-connector-knex/Home/Olympe/Extensions/Connectors/SQL_Connector_(knex)/SQL_Insert.newRel.json +1 -0
- package/import/extensions.sql-connector-knex/Home/Olympe/Extensions/Connectors/SQL_Connector_(knex)/SQL_Select.newInst.json +1 -0
- package/import/extensions.sql-connector-knex/Home/Olympe/Extensions/Connectors/SQL_Connector_(knex)/SQL_Select.newRel.json +1 -0
- package/import/extensions.sql-connector-knex/Home/Olympe/Extensions/Connectors/SQL_Connector_(knex)/SQL_Update.newInst.json +1 -0
- package/import/extensions.sql-connector-knex/Home/Olympe/Extensions/Connectors/SQL_Connector_(knex)/SQL_Update.newRel.json +1 -0
- package/import/extensions.sql-connector-knex/Home/Olympe/Extensions/Connectors/SQL_Connector_(knex)/Service_App.newInst.json +1 -0
- package/import/extensions.sql-connector-knex/Home/Olympe/Extensions/Connectors/SQL_Connector_(knex)/Service_App.newRel.json +1 -0
- package/main-node.js +676 -0
- package/main-node.js.map +1 -0
- package/main-web.js +116 -0
- package/main-web.js.map +1 -0
- package/package.json +1 -0
package/main-node.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main-node.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;;;;;;;;;;;;;ACV+D;AACpB;AACG;;AAE/B,wBAAwB,+CAAW;;AAElD;AACA;AACA,eAAe,eAAe;AAC9B,eAAe,GAAG;AAClB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,eAAe;AAC9B,eAAe,YAAY;AAC3B,eAAe,qBAAqB;AACpC;AACA;AACA,uBAAuB,yDAAS;AAChC,gBAAgB,cAAc,EAAE,mDAAS;;AAEzC;AACA,YAAY,gDAAM;AAClB;AACA,aAAa;AACb,UAAU;AACV,yBAAyB,oDAAgB;AACzC;AACA;AACA;;AAEA,qDAAa;;;;;;;;;;;;;;;;;;AC9BuC;AAChB;;AAErB,yBAAyB,+CAAW;;AAEnD;AACA;AACA;AACA,eAAe,eAAe;AAC9B,eAAe,GAAG;AAClB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB,eAAe,YAAY;AAC3B,eAAe,kBAAkB;AACjC,eAAe,iBAAiB;AAChC,eAAe,kBAAkB;AACjC,eAAe,aAAa;AAC5B;AACA;;AAEA,QAAQ,iDAAO;AACf;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA,qDAAa;;;;;;;;;;;;;;;;;;;;;;ACnC0D;AAC5B;AACnB;AACuB;;AAEhC,6BAA6B,+CAAW;AACvD;AACA;AACA,eAAe,eAAe;AAC9B,eAAe,QAAQ;A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;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;;AAEA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;;AAEA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACxJA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACLA;AACgB;;AAEhB;AACA;AAC0B,CAA4B,CAAmC,CAA4B,CAA2B,CAA2B,CAA2B;;AAEvK","sources":["webpack://@olympeio-extensions/sql-connector-knex/webpack/universalModuleDefinition","webpack://@olympeio-extensions/sql-connector-knex/./src/node/Delete.js","webpack://@olympeio-extensions/sql-connector-knex/./src/node/Execute.js","webpack://@olympeio-extensions/sql-connector-knex/./src/node/GetSQLDBConfig.js","webpack://@olympeio-extensions/sql-connector-knex/./src/node/Insert.js","webpack://@olympeio-extensions/sql-connector-knex/./src/node/Select.js","webpack://@olympeio-extensions/sql-connector-knex/./src/node/Update.js","webpack://@olympeio-extensions/sql-connector-knex/./src/node/helpers.js","webpack://@olympeio-extensions/sql-connector-knex/external commonjs \"@olympeio/core\"","webpack://@olympeio-extensions/sql-connector-knex/external commonjs \"knex\"","webpack://@olympeio-extensions/sql-connector-knex/external umd \"olympe\"","webpack://@olympeio-extensions/sql-connector-knex/webpack/bootstrap","webpack://@olympeio-extensions/sql-connector-knex/webpack/runtime/compat get default export","webpack://@olympeio-extensions/sql-connector-knex/webpack/runtime/define property getters","webpack://@olympeio-extensions/sql-connector-knex/webpack/runtime/hasOwnProperty shorthand","webpack://@olympeio-extensions/sql-connector-knex/webpack/runtime/make namespace object","webpack://@olympeio-extensions/sql-connector-knex/./src/main-node.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"olympe\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"olympe\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"@olympeio-extensions/sql-connector-knex\"] = factory(require(\"olympe\"));\n\telse\n\t\troot[\"@olympeio-extensions/sql-connector-knex\"] = factory(root[\"olympe\"]);\n})(this, (__WEBPACK_EXTERNAL_MODULE_olympe__) => {\nreturn ","import { ActionBrick, registerBrick, ErrorFlow } from 'olympe';\nimport { getLogger } from '@olympeio/core';\nimport { remove, getAsJson } from './helpers';\n\nexport default class SQLDelete extends ActionBrick {\n\n /**\n * @protected\n * @param {!BrickContext} context\n * @param {*} sQLDBConfig\n * @param {string} schema\n * @param {string} table\n * @param {string|Object} whereConditions\n * @param {function()} forwardEvent\n * @param {function(ErrorFlow)} setErrorFlow\n */\n update(context, [knexClient, schema, table, whereConditions], [forwardEvent, setErrorFlow]) {\n const logger = getLogger('Delete SQL');\n const { json, error } = getAsJson(logger, whereConditions);\n\n if (!error) {\n remove(knexClient, schema, table, json, () => {\n forwardEvent();\n }, setErrorFlow);\n } else {\n setErrorFlow(ErrorFlow.create('Error while parsing data: ' + error.message, 1));\n }\n }\n}\n\nregisterBrick('017d384c15832d2e4461', SQLDelete);\n","import { ActionBrick, registerBrick } from 'olympe';\nimport { execute } from './helpers';\n\nexport default class SQLExecute extends ActionBrick {\n\n /**\n * @override\n * @protected\n * @param {!BrickContext} $\n * @param {*} sQLConfig\n * @param {string} schema\n * @param {string} sqlQuery\n * @param {function()} forwardEvent\n * @param {function(Object)} setMetaData\n * @param {function(Array)} setData\n * @param {function(number)} setCount\n * @param {function(*)} setErrorFlow\n */\n update($, [sQLConfig, schema, sqlQuery], [forwardEvent, setMetaData, setData, setCount, setErrorFlow]) {\n\n execute(sQLConfig, schema, sqlQuery, (result) => {\n setMetaData(result);\n\n // The response is depending on the database.\n // For PG & some others we got the lines in the \"rows\" properties so we expose it directly.\n // Otherwise for MSSQL for example the results comes directly in the root level\n const rows = result['rows'] ?? result;\n setData(rows);\n setCount(Array.isArray(rows) ? rows.length : 0);\n forwardEvent();\n }, setErrorFlow);\n\n }\n}\n\nregisterBrick('018085271ab460a2f084', SQLExecute);\n","import { ActionBrick, registerBrick, Config, ErrorFlow } from 'olympe';\nimport { getLogger } from '@olympeio/core';\nimport knex from 'knex';\nimport { dbConnectionHolder } from './helpers';\n\nexport default class GetSQLDBConfig extends ActionBrick {\n /**\n * @protected\n * @param {!BrickContext} context\n * @param {string} configIdentifier\n * @param {function()} forwardEvent\n * @param {function(*)} setKnexClient\n * @param {function(*)} setErrorFlow\n */\n update(context, [configIdentifier], [forwardEvent, setKnexClient, setErrorFlow]) {\n const logger = getLogger('GetSQLDBConfig');\n\n const errors = []\n const getParameter = (name, mandatory = true) => {\n const value = Config.getParameter(`sql_db.${configIdentifier}.${name}`);\n if (value === undefined && mandatory) {\n errors.push(`Mandatory parameter sql_db.${configIdentifier}.${name} not provided`);\n }\n return value;\n }\n\n // instantiate client\n const client = getParameter('db_client');\n const connection = {\n host: getParameter('db_host'),\n port: getParameter('db_port'),\n user: getParameter('db_user'),\n password: getParameter('db_password'),\n database: getParameter('db_name')\n }\n\n // Read the options parameter, mandatory for mssql, set it up only if required\n // because options on the connection variable is supposed to be a string for the pg client & an object for the mssql client\n const options = getParameter('db_options', false);\n if(options !== undefined){\n connection['options'] = options;\n }\n\n if (errors.length === 0) {\n let knexClient = dbConnectionHolder().getByKey(configIdentifier);\n if (!knexClient) {\n knexClient = knex({\n client: client,\n connection: connection\n });\n dbConnectionHolder().set(configIdentifier, knexClient);\n }\n\n setKnexClient(knexClient);\n forwardEvent();\n } else {\n const errorMsg = errors.join('\\n');\n logger.error(errorMsg);\n setErrorFlow(ErrorFlow.create(errorMsg, 1));\n }\n }\n}\n\nregisterBrick('017d290ade8ab204486f', GetSQLDBConfig);\n","import { ActionBrick, registerBrick, ErrorFlow } from 'olympe';\nimport { getLogger } from '@olympeio/core';\nimport { insert, getAsJson } from './helpers';\n\nexport default class Insert extends ActionBrick {\n\n /**\n * @protected\n * @param {!BrickContext} context\n * @param {*} knexClient\n * @param {string} schema\n * @param {string} table\n * @param {string|Object} data\n * @param {function()} forwardEvent\n * @param {function(ErrorFlow)} setErrorFlow\n */\n update(context, [knexClient, schema, table, data], [forwardEvent, setErrorFlow]) {\n const logger = getLogger('Insert SQL');\n const { json, error } = getAsJson(logger, data);\n\n if (!error) {\n insert(knexClient, schema, table, json, () => {\n forwardEvent();\n }, setErrorFlow);\n } else {\n setErrorFlow(ErrorFlow.create('Error while parsing data: ' + error.message, 1));\n }\n }\n}\n\nregisterBrick('017d29101a1ca310eac4', Insert);\n","import { ActionBrick, registerBrick, ErrorFlow } from 'olympe';\nimport { getLogger } from '@olympeio/core';\nimport { select, getAsJson } from './helpers';\n\nexport default class Select extends ActionBrick {\n\n /**\n * @param {!Context} context\n * @param {*} knexClient\n * @param {string} schema\n * @param {string} table\n * @param {string|Object} whereConditions\n * @param {boolean} disjunctiveWhere\n * @param {function()} forwardEvent\n * @param {function(!Array)} setTuples\n * @param {function(ErrorFlow)} setErrorFlow\n */\n update(context, [knexClient, schema, table, whereConditions], [forwardEvent, setTuples, setErrorFlow]) {\n const logger = getLogger('Select SQL');\n const whereConditionJson = getAsJson(logger, whereConditions);\n const { json, error } = whereConditionJson;\n\n if (!error) {\n select(knexClient, schema, table, json, (rows) => {\n setTuples(rows);\n forwardEvent();\n }, setErrorFlow);\n } else {\n setErrorFlow(ErrorFlow.create('Error while parsing whereCondition: ' + error.message, 1));\n }\n }\n}\n\nregisterBrick('017d2914303ce4bd3a2a', Select);\n","import { ActionBrick, registerBrick, ErrorFlow } from 'olympe';\nimport { getLogger } from '@olympeio/core';\nimport { update, getAsJson } from './helpers';\n\nexport default class Update extends ActionBrick {\n\n /**\n * @protected\n * @param {!BrickContext} context\n * @param {*} knexClient\n * @param {string} schema\n * @param {string} table\n * @param {string|Object} whereConditions\n * @param {string|Object} data\n * @param {function()} forwardEvent\n * @param {function(ErrorFlow)} setErrorFlow\n */\n update(context, [knexClient, schema, table, whereConditions, data], [forwardEvent, setErrorFlow]) {\n const logger = getLogger('Update SQL');\n const dataJson = getAsJson(logger, data);\n const whereConditionJson = getAsJson(logger, whereConditions);\n\n if (dataJson.error) {\n setErrorFlow(ErrorFlow.create('Error while parsing dataJson: ' + dataJson.error.message, 1));\n } else if (whereConditionJson.error) {\n setErrorFlow(ErrorFlow.create('Error while parsing whereConditionJson: ' + whereConditionJson.error.message, 1));\n } else {\n update(knexClient, schema, table, dataJson.json, whereConditionJson.json, () => {\n forwardEvent();\n }, setErrorFlow);\n }\n }\n}\n\nregisterBrick('017d94b36645c31881f1', Update);\n","import { ErrorFlow } from 'olympe';\n\nexport const checkTable = (knexClient, schema, table, onSuccess, setErrorFlow) => {\n knexClient.schema.withSchema(schema).hasTable(table)\n .then(exists => {\n if (!exists) {\n setErrorFlow(ErrorFlow.create(`Table ${table} doesn't exists`, 1));\n } else {\n onSuccess();\n }\n })\n .catch(reason => {\n setErrorFlow(ErrorFlow.create(`An error was encountered when checking if table ${table} exists: ${reason}`, 2));\n });\n};\n\nexport const select = (knexClient, schema, table, whereConditions, onSuccess, setErrorFlow) => {\n checkTable(knexClient, schema, table, () => {\n let query = knexClient(table).withSchema(schema);\n\n query = query.select();\n if (whereConditions) {\n query = query.where(whereConditions);\n }\n\n query\n .then(rows => onSuccess(rows))\n .catch(err => {\n setErrorFlow(ErrorFlow.create(err.message, 1));\n });\n }, setErrorFlow);\n};\n\nexport const update = (knexClient, schema, table, data, whereConditions, onSuccess, setErrorFlow) => {\n checkTable(knexClient, schema, table, () => {\n let query = knexClient(table).withSchema(schema).update(data);\n\n if (whereConditions) {\n query = query.where(whereConditions);\n }\n\n query\n .then(() => onSuccess())\n .catch(err => setErrorFlow(ErrorFlow.create(err.message, 1)));\n\n }, setErrorFlow);\n};\n\nexport const insert = (knexClient, schema, table, data, onSuccess, setErrorFlow) => {\n checkTable(knexClient, schema, table, () => {\n let query = knexClient(table).withSchema(schema).insert(data);\n\n query\n .then(() => onSuccess())\n .catch(err => setErrorFlow(ErrorFlow.create(err.message, 1)));\n\n }, setErrorFlow);\n};\n\nexport const remove = (knexClient, schema, table, whereConditions, onSuccess, setErrorFlow) => {\n checkTable(knexClient, schema, table, () => {\n let query = knexClient(table).withSchema(schema);\n\n query = query.select();\n if (whereConditions) {\n query = query.where(whereConditions);\n }\n query = query.del();\n\n query\n .then(() => onSuccess())\n .catch(err => setErrorFlow(ErrorFlow.create(err.message, 1)));\n\n }, setErrorFlow);\n};\n\nexport const execute = (knexClient, schema, sqlQuery, onSuccess, setErrorFlow) => {\n knexClient.schema.withSchema(schema).raw(sqlQuery)\n .then((result) => onSuccess(result))\n .catch(err => setErrorFlow(ErrorFlow.create(`Error encountered (${err.message}) during the execution of the query : ${sqlQuery}`, 1)));\n};\n\nexport const getAsJson = (logger, data) => {\n try {\n const dataJson = (typeof data === 'string') ? JSON.parse(data) : data;\n return { json: dataJson, error: null };\n } catch (e) {\n return { json: null, error: e };\n }\n};\n\nclass DbConnectionHolder {\n /**\n * @public\n * @return {DbConnectionHolder}\n */\n constructor() {\n // Check if an instance already exists (Lazy loading)\n if (!DbConnectionHolder.instance) {\n /**\n * @type {Map<String, Object>}\n */\n this.connectionMap = new Map();\n\n /**\n * The DbConnectionHolder Singleton instance\n * @private\n * @type {DbConnectionHolder}\n */\n DbConnectionHolder.instance = this;\n }\n return DbConnectionHolder.instance;\n }\n\n /**\n * @public\n * @return {Object}\n */\n getByKey(key) {\n return this.connectionMap.get(key);\n }\n\n /**\n * @public\n * @return {Array}\n */\n getKeys() {\n return [...this.connectionMap.keys()];\n }\n\n /**\n * @public\n */\n set(key, value) {\n this.connectionMap.set(key, value);\n }\n\n /**\n * @public\n */\n clear() {\n this.connectionMap.clear();\n }\n}\n\nlet instance = null;\nexport const dbConnectionHolder = () => {\n if (instance === null) {\n // Instantiate the Singleton\n instance = new DbConnectionHolder();\n }\n return instance;\n}\n","module.exports = require(\"@olympeio/core\");","module.exports = require(\"knex\");","module.exports = __WEBPACK_EXTERNAL_MODULE_olympe__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","\n// Import Olympe runtime or DRAW\nimport 'olympe';\n\n// Import project bricks (we use webpack-import-glob-loader to import all bricks)\n;\nimport './node/Delete.js'; import './node/Execute.js'; import './node/GetSQLDBConfig.js'; import './node/helpers.js'; import './node/Insert.js'; import './node/Select.js'; import './node/Update.js';\n\nexport * from './node/helpers';\n"],"names":[],"sourceRoot":""}
|
package/main-web.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
+
module.exports = factory(require("olympe"));
|
|
4
|
+
else if(typeof define === 'function' && define.amd)
|
|
5
|
+
define(["olympe"], factory);
|
|
6
|
+
else if(typeof exports === 'object')
|
|
7
|
+
exports["@olympeio-extensions/sql-connector-knex"] = factory(require("olympe"));
|
|
8
|
+
else
|
|
9
|
+
root["@olympeio-extensions/sql-connector-knex"] = factory(root["olympe"]);
|
|
10
|
+
})(this, (__WEBPACK_EXTERNAL_MODULE_olympe__) => {
|
|
11
|
+
return /******/ (() => { // webpackBootstrap
|
|
12
|
+
/******/ "use strict";
|
|
13
|
+
/******/ var __webpack_modules__ = ({
|
|
14
|
+
|
|
15
|
+
/***/ "olympe":
|
|
16
|
+
/*!*************************!*\
|
|
17
|
+
!*** external "olympe" ***!
|
|
18
|
+
\*************************/
|
|
19
|
+
/***/ ((module) => {
|
|
20
|
+
|
|
21
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_olympe__;
|
|
22
|
+
|
|
23
|
+
/***/ })
|
|
24
|
+
|
|
25
|
+
/******/ });
|
|
26
|
+
/************************************************************************/
|
|
27
|
+
/******/ // The module cache
|
|
28
|
+
/******/ var __webpack_module_cache__ = {};
|
|
29
|
+
/******/
|
|
30
|
+
/******/ // The require function
|
|
31
|
+
/******/ function __webpack_require__(moduleId) {
|
|
32
|
+
/******/ // Check if module is in cache
|
|
33
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
34
|
+
/******/ if (cachedModule !== undefined) {
|
|
35
|
+
/******/ return cachedModule.exports;
|
|
36
|
+
/******/ }
|
|
37
|
+
/******/ // Create a new module (and put it into the cache)
|
|
38
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
39
|
+
/******/ // no module.id needed
|
|
40
|
+
/******/ // no module.loaded needed
|
|
41
|
+
/******/ exports: {}
|
|
42
|
+
/******/ };
|
|
43
|
+
/******/
|
|
44
|
+
/******/ // Execute the module function
|
|
45
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
46
|
+
/******/
|
|
47
|
+
/******/ // Return the exports of the module
|
|
48
|
+
/******/ return module.exports;
|
|
49
|
+
/******/ }
|
|
50
|
+
/******/
|
|
51
|
+
/************************************************************************/
|
|
52
|
+
/******/ /* webpack/runtime/compat get default export */
|
|
53
|
+
/******/ (() => {
|
|
54
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
55
|
+
/******/ __webpack_require__.n = (module) => {
|
|
56
|
+
/******/ var getter = module && module.__esModule ?
|
|
57
|
+
/******/ () => (module['default']) :
|
|
58
|
+
/******/ () => (module);
|
|
59
|
+
/******/ __webpack_require__.d(getter, { a: getter });
|
|
60
|
+
/******/ return getter;
|
|
61
|
+
/******/ };
|
|
62
|
+
/******/ })();
|
|
63
|
+
/******/
|
|
64
|
+
/******/ /* webpack/runtime/define property getters */
|
|
65
|
+
/******/ (() => {
|
|
66
|
+
/******/ // define getter functions for harmony exports
|
|
67
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
68
|
+
/******/ for(var key in definition) {
|
|
69
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
70
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
71
|
+
/******/ }
|
|
72
|
+
/******/ }
|
|
73
|
+
/******/ };
|
|
74
|
+
/******/ })();
|
|
75
|
+
/******/
|
|
76
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
77
|
+
/******/ (() => {
|
|
78
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
79
|
+
/******/ })();
|
|
80
|
+
/******/
|
|
81
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
82
|
+
/******/ (() => {
|
|
83
|
+
/******/ // define __esModule on exports
|
|
84
|
+
/******/ __webpack_require__.r = (exports) => {
|
|
85
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
86
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
87
|
+
/******/ }
|
|
88
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
89
|
+
/******/ };
|
|
90
|
+
/******/ })();
|
|
91
|
+
/******/
|
|
92
|
+
/************************************************************************/
|
|
93
|
+
var __webpack_exports__ = {};
|
|
94
|
+
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
|
|
95
|
+
(() => {
|
|
96
|
+
/*!*************************!*\
|
|
97
|
+
!*** ./src/main-web.js ***!
|
|
98
|
+
\*************************/
|
|
99
|
+
__webpack_require__.r(__webpack_exports__);
|
|
100
|
+
/* harmony import */ var olympe__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! olympe */ "olympe");
|
|
101
|
+
/* harmony import */ var olympe__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(olympe__WEBPACK_IMPORTED_MODULE_0__);
|
|
102
|
+
// Import Olympe runtime or DRAW
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
// Import project bricks (we use webpack-import-glob-loader to import all bricks)
|
|
106
|
+
;
|
|
107
|
+
;
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
})();
|
|
111
|
+
|
|
112
|
+
/******/ return __webpack_exports__;
|
|
113
|
+
/******/ })()
|
|
114
|
+
;
|
|
115
|
+
});
|
|
116
|
+
//# sourceMappingURL=main-web.js.map
|
package/main-web.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main-web.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;;;;ACVA;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA;WACA;WACA,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA;;;;;WCAA;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;;;ACNA;AACgB;;AAEhB;AACA;AACA","sources":["webpack://@olympeio-extensions/sql-connector-knex/webpack/universalModuleDefinition","webpack://@olympeio-extensions/sql-connector-knex/external umd \"olympe\"","webpack://@olympeio-extensions/sql-connector-knex/webpack/bootstrap","webpack://@olympeio-extensions/sql-connector-knex/webpack/runtime/compat get default export","webpack://@olympeio-extensions/sql-connector-knex/webpack/runtime/define property getters","webpack://@olympeio-extensions/sql-connector-knex/webpack/runtime/hasOwnProperty shorthand","webpack://@olympeio-extensions/sql-connector-knex/webpack/runtime/make namespace object","webpack://@olympeio-extensions/sql-connector-knex/./src/main-web.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"olympe\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"olympe\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"@olympeio-extensions/sql-connector-knex\"] = factory(require(\"olympe\"));\n\telse\n\t\troot[\"@olympeio-extensions/sql-connector-knex\"] = factory(root[\"olympe\"]);\n})(this, (__WEBPACK_EXTERNAL_MODULE_olympe__) => {\nreturn ","module.exports = __WEBPACK_EXTERNAL_MODULE_olympe__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// Import Olympe runtime or DRAW\nimport 'olympe';\n\n// Import project bricks (we use webpack-import-glob-loader to import all bricks)\n;\n;\n\n"],"names":[],"sourceRoot":""}
|
package/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"@olympeio-extensions/sql-connector-knex","version":"2.4.4","main":"main-node.js","browser":"main-web.js","dependencies":{"@olympeio/core":"2.4.4","@olympeio/runtime-web":"~9.4.5","@olympeio/runtime-node":"~9.4.5","knex":"2.4.2"},"dcInitConfig":"import/dcInitConfig.json"}
|