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-asc-record.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 create(bundleId, sku, names) {44 for (const name of names) {45 const body = {data:{type:"apps",attributes:{sku, primaryLocale:"en-CA", bundleId},46 relationships:{appStoreVersions:{data:[{type:"appStoreVersions",id:"${store-version-ios}"}]},appInfos:{data:[{type:"appInfos",id:"${new-appInfo-id}"}]}}},47 included:[{type:"appStoreVersions",id:"${store-version-ios}",attributes:{platform:"IOS",versionString:"1.0.0"},relationships:{appStoreVersionLocalizations:{data:[{type:"appStoreVersionLocalizations",id:"${new-appStoreVersionLocalization-id}"}]}}},48 {type:"appStoreVersionLocalizations",id:"${new-appStoreVersionLocalization-id}",attributes:{locale:"en-CA"}},49 {type:"appInfos",id:"${new-appInfo-id}",relationships:{appInfoLocalizations:{data:[{type:"appInfoLocalizations",id:"${new-appInfoLocalization-id}"}]}}},50 {type:"appInfoLocalizations",id:"${new-appInfoLocalization-id}",attributes:{locale:"en-CA",name}}]};51 const r = await fetch('/iris/v1/apps',{method:'POST',credentials:'include',headers:{'Content-Type':'application/json','X-Csrf-Itc':'[asc-ui]'},body:JSON.stringify(body)});52 const t = await r.text();53 if (r.status < 300) { const j = JSON.parse(t); return bundleId+' OK id='+j.data.id+' name='+name; }54 const msg = (()=>{try{return JSON.stringify(JSON.parse(t).errors.map(e=>[e.code,e.detail,e.source]))}catch(e){return t.slice(0,400)}})();55 if (!/name|NAME/.test(msg) || names.indexOf(name) === names.length-1) return bundleId+' FAIL '+r.status+' '+msg;56 }57}58async function main(){ return await create('ai.spboucher.orix.maps','orix-maps-ios-001',['ORIX Maps','ORIX Maps Offline','ORIX Maps: Offline Navigation']); }59