Repository Public BSD-3-Clause
1/**2 * =============================================================================3 * SP BOUCHER | SOFTWARE & RESEARCH4 * ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project : ORIX Maps8 * File : scripts/portal/create-app-id.js9 * Module : scripts10 * Repository : https://git.spboucher.ai/orix-maps11 * Created : 2026-11-2512 * Last Modified : 2026-11-2513 *14 * Author : Simon-Pierre Boucher15 * Position : Professor of Finance16 * Institution : Université du Québec en Outaouais (UQO)17 * Organization : SP Boucher18 * Website : https://spboucher.ai19 * Git : https://git.spboucher.ai20 *21 * Preferred Contact: support@spboucher.ai22 * Development : dev@spboucher.ai23 * Support : support@spboucher.ai24 * Security/Admin : admin@spboucher.ai25 *26 * Copyright (c) 202627 * Simon-Pierre Boucher28 * All rights reserved where applicable. This file is governed by the29 * applicable project license, copyright notices and relevant law.30 * Existing third-party rights and notices remain unaffected.31 *32 * License : Proprietary, all rights reserved (see license file)33 * License File : LICENSE34 *35 * Do not embed credentials, private keys, access tokens,36 * certificates or confidential personal information.37 *38 * =============================================================================39 * END OF SP BOUCHER SOURCE HEADER40 * =============================================================================41 */4243async function main(){44 const H = {'Content-Type':'application/vnd.api+json','Accept':'application/vnd.api+json, application/json, text/plain, */*','X-Requested-With':'XMLHttpRequest'};45 const q = await fetch('/services-account/v1/bundleIds',{method:'POST',credentials:'include',headers:{...H,'X-HTTP-Method-Override':'GET'},body:JSON.stringify({urlEncodedQueryParams:'limit=5&filter[identifier]=ai.spboucher.orix.maps',teamId:'3YM54G49SN'})});46 const existing = (await q.json()).data.filter(d=>d.attributes.identifier==='ai.spboucher.orix.maps');47 if (existing.length) return 'EXISTS '+existing[0].id+' '+existing[0].attributes.name;48 const csrf = q.headers.get('csrf'), ts = q.headers.get('csrf_ts');49 const body = {data:{type:'bundleIds',attributes:{identifier:'ai.spboucher.orix.maps',name:'ORIX Maps',seedId:'3YM54G49SN',teamId:'3YM54G49SN'},relationships:{bundleIdCapabilities:{data:[]}}}};50 const r = await fetch('/services-account/v1/bundleIds',{method:'POST',credentials:'include',headers:{...H,...(csrf?{csrf:csrf,csrf_ts:ts}:{})},body:JSON.stringify(body)});51 const t = await r.text();52 try { const j = JSON.parse(t); if (j.data) return 'CREATED '+j.data.id+' '+JSON.stringify(j.data.attributes).slice(0,400); return 'FAIL '+r.status+' '+JSON.stringify(j.errors||j).slice(0,600); } catch(e){ return 'FAIL '+r.status+' '+t.slice(0,400); }53}54