@xuda.io/ai_module 1.1.4420 → 1.1.4422

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.
Files changed (3) hide show
  1. package/index.mjs +2 -1
  2. package/old.mjs +211 -0
  3. package/package.json +1 -1
package/index.mjs CHANGED
@@ -5667,7 +5667,8 @@ const create_and_upload_image_to_drive = async function (drive_type, file_path,
5667
5667
  };
5668
5668
 
5669
5669
  export const create_avatar = async function (req, job_id, headers) {
5670
- const { docType, uid, url, _id, name, account_type, metadata } = req;
5670
+ const { docType, uid, url, _id, name, account_type } = req;
5671
+ let { metadata } = req;
5671
5672
  try {
5672
5673
  if (!['account', 'account_profile'].includes(docType)) {
5673
5674
  throw new Error('invalid docType value');
package/old.mjs CHANGED
@@ -1830,3 +1830,214 @@ for await (let account_profile of profile_requests_from_res.docs) {
1830
1830
  if (!account_profile.access_view.includes('apps')) continue;
1831
1831
  }
1832
1832
  ///////////////////////////
1833
+
1834
+ // export const copy_account_profile_resources = async (team_req_id) => {
1835
+ // const req_obj_ret = await db_module.get_couch_doc('xuda_team', team_req_id);
1836
+ // if (req_obj_ret.code < 0) {
1837
+ // return { code: -400, data: 'error - team request not found' };
1838
+ // }
1839
+ // const req_obj = req_obj_ret.data;
1840
+
1841
+ //
1842
+ // const sender_app_id = await account_module.get_account_default_project_id(req_obj.team_req_from_uid);
1843
+ // const receiver_app_id = await account_module.get_account_default_project_id(req_obj.team_req_to_uid);
1844
+
1845
+ // for (const access_view of req_obj.access_view) {
1846
+ // switch (access_view) {
1847
+ // case 'apps': {
1848
+ // const opt = {
1849
+ // selector: {
1850
+ // docType: 'studio',
1851
+ // stat: 3,
1852
+ // 'studio_meta.miniApp': true,
1853
+ // 'studio_meta.createdByUid': req_obj.team_req_from_uid,
1854
+ // },
1855
+ // limit: 999,
1856
+ // fields: ['_id'],
1857
+ // };
1858
+ // const user_apps = await db_module.find_app_couch_query(sender_app_id, opt);
1859
+ // for (const miniapp of user_apps.docs) {
1860
+ // await share_miniapp_and_ai_agent(team_req_id, miniapp._id);
1861
+ // }
1862
+
1863
+ // break;
1864
+ // }
1865
+
1866
+ // case 'ai_agents': {
1867
+ // const opt = {
1868
+ // selector: {
1869
+ // docType: 'studio',
1870
+ // stat: 3,
1871
+
1872
+ // 'studio_meta.createdByUid': req_obj.team_req_from_uid,
1873
+ // 'properties.menuType': 'ai_agent',
1874
+ // },
1875
+ // limit: 999,
1876
+ // fields: ['_id'],
1877
+ // };
1878
+ // const user_ai_agents = await db_module.find_app_couch_query(sender_app_id, opt);
1879
+ // for (const ai_agent of user_ai_agents.docs) {
1880
+ // await share_miniapp_and_ai_agent(team_req_id, ai_agent._id);
1881
+ // }
1882
+
1883
+ // break;
1884
+ // }
1885
+ // case 'contacts': {
1886
+ // const opt = {
1887
+ // selector: {
1888
+ // docType: 'contact',
1889
+ // stat: 3,
1890
+
1891
+ // uid: req_obj.team_req_from_uid,
1892
+ // },
1893
+ // limit: 999,
1894
+ // fields: ['_id'],
1895
+ // };
1896
+ // const user_contacts = await db_module.find_couch_query('xuda_contacts', opt);
1897
+ // for (const contact of user_contacts.docs) {
1898
+ // await share_contact(team_req_id, contact._id);
1899
+ // }
1900
+
1901
+ // break;
1902
+ // }
1903
+ // default:
1904
+ // break;
1905
+ // }
1906
+ // }
1907
+ // // const opt = {};
1908
+
1909
+ // // from_opt.access_type = 'account_profile';
1910
+ // // from_opt.access_type = 3;
1911
+ // // const profile_requests_from_res = await db_module.find_couch_query('xuda_team', from_opt);
1912
+ // // for await (let account_profile of profile_requests_from_res.docs) {
1913
+ // // if (!account_profile.access_view.includes('apps')) continue;
1914
+ // // }
1915
+ // // return req_obj;
1916
+ // };
1917
+
1918
+ // export const change_account_profile_dependencies_status = async (team_req_id, stat) => {
1919
+ // const req_obj_ret = await db_module.get_couch_doc('xuda_team', team_req_id);
1920
+ // if (req_obj_ret.code < 0) {
1921
+ // return { code: -400, data: 'error - team request not found' };
1922
+ // }
1923
+ // const req_obj = req_obj_ret.data;
1924
+
1925
+ //
1926
+ // const sender_app_id = await account_module.get_account_default_project_id(req_obj.team_req_from_uid);
1927
+ // const receiver_app_id = await account_module.get_account_default_project_id(req_obj.team_req_to_uid);
1928
+ // let save_ret = [];
1929
+ // const d = Date.now();
1930
+ // let opt = {
1931
+ // selector: {
1932
+ // docType: 'studio',
1933
+ // 'studio_meta.team_req_id': team_req_id,
1934
+ // },
1935
+ // limit: 9999,
1936
+ // // fields: ['_id', '_rev', 'stat'],
1937
+ // };
1938
+ // const res = await db_module.find_app_couch_query(receiver_app_id, opt);
1939
+ // for (let item of res.docs) {
1940
+ // if (stat === 4) {
1941
+ // item._deleted = true;
1942
+ // } else {
1943
+ // item.stat = stat;
1944
+ // item.stat_ts = d;
1945
+ // }
1946
+ // }
1947
+ // save_ret = [...save_ret, ...(await db_module.sava_app_couch_bulk_docs(receiver_app_id, res.docs))];
1948
+
1949
+ // opt = {
1950
+ // selector: {
1951
+ // docType: 'contact',
1952
+
1953
+ // team_req_id: team_req_id,
1954
+ // },
1955
+ // limit: 9999,
1956
+ // // fields: ['_id', '_rev'],
1957
+ // };
1958
+
1959
+ // const user_contacts = await db_module.find_couch_query('xuda_contacts', opt);
1960
+ // for (let contact of user_contacts.docs) {
1961
+ // if (stat === 4) {
1962
+ // contact._deleted = true;
1963
+ // } else {
1964
+ // contact.stat = stat;
1965
+ // contact.stat_ts = d;
1966
+ // }
1967
+ // }
1968
+ // save_ret = [...save_ret, ...(await db_module.save_couch_bulk_docs('xuda_contacts', user_contacts.docs))];
1969
+
1970
+ // opt = {
1971
+ // selector: {
1972
+ // docType: 'account_profile',
1973
+ // team_req_id: team_req_id,
1974
+ // },
1975
+ // limit: 9999,
1976
+ // // fields: ['_id', '_rev'],
1977
+ // };
1978
+
1979
+ // const account_profiles = await db_module.find_couch_query('xuda_accounts', opt);
1980
+ // for (let account_profile of account_profiles.docs) {
1981
+ // if (stat === 4) {
1982
+ // account_profile._deleted = true;
1983
+ // } else {
1984
+ // account_profile.stat = stat;
1985
+ // account_profile.stat_ts = d;
1986
+ // }
1987
+ // }
1988
+ // save_ret = [...save_ret, ...(await db_module.save_couch_bulk_docs('xuda_accounts', account_profiles.docs))];
1989
+
1990
+ // return { code: 33, data: save_ret };
1991
+ // };
1992
+ // export const account_profile_shares_change_handler = async (uid, access_view, doc_id) => {
1993
+ // var opt = {
1994
+ // selector: {
1995
+ // docType: 'account_profile',
1996
+ // uid,
1997
+ // stat: 3,
1998
+ // },
1999
+ // };
2000
+ //
2001
+ // const profiles = await db_module.find_couch_query('xuda_accounts', opt);
2002
+ // for await (let doc of profiles.docs) {
2003
+ // // console.log('doc', doc);
2004
+
2005
+ // let selector = { docType: 'team_request', team_req_stat: 3, share_item_id: doc._id, access_type: 'account_profile', team_req_from_uid: uid };
2006
+ // const account_profile_shares = await db_module.find_couch_query('xuda_team', { selector });
2007
+ // for await (let req_obj of account_profile_shares.docs) {
2008
+ // if (!req_obj?.access_view?.includes(access_view)) continue;
2009
+ // const receiver_app_id = await account_module.get_account_default_project_id(req_obj.team_req_to_uid);
2010
+ // switch (access_view) {
2011
+ // case 'ai_agents':
2012
+ // case 'apps': {
2013
+ // let opt = {
2014
+ // selector: {
2015
+ // _id: doc_id,
2016
+ // docType: 'studio',
2017
+ // 'studio_meta.team_req_id': req_obj.team_req_id,
2018
+ // },
2019
+ // limit: 1,
2020
+ // };
2021
+ // const res = await db_module.find_app_couch_query(receiver_app_id, opt);
2022
+ // console.log('>>>>>>>>>res', res);
2023
+ // debugger;
2024
+ // let doc = res?.docs?.[0];
2025
+ // if (doc) {
2026
+ // doc._deleted = true;
2027
+ // const save_ret = await db_module.save_app_couch_doc(receiver_app_id, doc);
2028
+ // share_miniapp_and_ai_agent(req_obj.team_req_id, doc_id);
2029
+ // }
2030
+ // break;
2031
+ // }
2032
+
2033
+ // case 'contacts': {
2034
+ // break;
2035
+ // }
2036
+ // default:
2037
+ // break;
2038
+ // }
2039
+ // }
2040
+ // }
2041
+ // };
2042
+
2043
+ // The one-liner wrapper
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/ai_module",
3
- "version": "1.1.4420",
3
+ "version": "1.1.4422",
4
4
  "description": "Xuda AI Module",
5
5
  "main": "index.mjs",
6
6
  "type": "module",