{"version":3,"sources":["jsdelivr-header.js","/npm/react-native-sync@1.0.12/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,OCNO,YAAa,sBACb,UAAW,oBACX,UAAW,oBACX,OAAQ,UAEf,eAAe,OAAO,EAAU,GAO9B,GAJA,QAAQ,SAAW,OAAO,OAAO,QAAQ,SAAU,KAGnD,EAAW,QAAQ,UACL,gBAAkB,EAAS,eAAiB,EAAS,iBACjE,MAAM,IAAI,MAAM,8EAGb,EAAS,OACZ,EAAS,KAAO,GAAG,oBAGf,MAAM,MAAM,EACpB,CAEA,SAAS,SAAS,GAChB,GAAI,QAAQ,SAAS,WACnB,OAAO,MAAM,SAAS,GAEtB,MAAM,IAAI,MAAM,wCAEpB,CAEA,SAAS,QAAQ,GACf,GAAI,QAAQ,SAAS,WACnB,OAAO,MAAM,QAAQ,GAErB,MAAM,IAAI,MAAM,uCAEpB,CAEA,eAAe,OAGb,GAFA,QAAQ,IAAI,yBAA2B,QAAQ,SAAS,MAEpD,QAAQ,SAAS,WAAY,CAC/B,IAAI,QAAoB,MAAM,OAM9B,OAJ6B,MAAzB,EAAY,kBACR,MAAM,OAAM,GAClB,QAAoB,MAAM,QAErB,CACT,CACE,MAAM,IAAI,MAAM,oCAEpB,eAEe,CACb,cACA,UACA,kBACA,gBACA,iBAAkB,MAAM,iBACxB,iBAAkB,MAAM,iBACxB,gBAAiB,MAAM,gBACvB,gBAAiB,MAAM","file":"/npm/react-native-sync@1.0.12/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/react-native-sync@1.0.12/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import context from './context.js'\nimport setup from \"./setup.js\";\nimport agent from \"./agent.js\";\nimport fs from \"./fs.js\";\n\nasync function config(settings, reset) {\n\n  //console.log(\"pervasync index.js, settings=\" + JSON.stringify(settings));\n  context.settings = Object.assign(context.settings, settings);\n  //console.log(\"pervasync index.js, context.settings=\" + JSON.stringify(settings));\n\n  settings = context.settings;\n  if (!settings.syncServerUrl || !settings.syncUserName || !settings.syncUserPassword) {\n    throw new Error(\"syncServerUrl, syncUserName and syncUserPassword are required in settings.\");\n  }\n\n  if (!settings.path) {\n    settings.path = fs.PervasyncDir;\n  }\n\n  await setup.setup(reset);\n}\n\nfunction getRealm(schemaName) {\n  if (context.settings.configured) {\n    return agent.getRealm(schemaName);\n  } else {\n    throw new Error(\"Call Pervasync config before getRealm\");\n  }\n}\n\nfunction getPath(folderName) {\n  if (context.settings.configured) {\n    return agent.getPath(folderName);\n  } else {\n    throw new Error(\"Call Pervasync config before getPath\");\n  }\n}\n\nasync function sync() {\n  console.log(\"context.settings.path=\" + context.settings.path);\n\n  if (context.settings.configured) {\n    let syncSummary = await agent.sync();\n    // PVS_WRONG_SYNC_SERVER_ID = 2025\n    if (syncSummary.errorCode == 2025) {\n      await setup.setup(true);\n      syncSummary = await agent.sync();\n    }\n    return syncSummary;\n  } else {\n    throw new Error(\"Call Pervasync config before sync\");\n  }\n}\n\nexport default {\n  config,\n  sync,\n  getRealm,\n  getPath,\n  clientSchemaList: agent.clientSchemaList,\n  clientFolderList: agent.clientFolderList,\n  clientSchemaMap: agent.clientSchemaMap,\n  clientFolderMap: agent.clientFolderMap\n}\n"]}