SPB Git

Repository Public

create-asc-record.js 3.6 KB 62 lines javascript

1/**2 * =============================================================================3 *                  SP BOUCHER | INFRASTRUCTURE & AUTOMATION4 *             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project          : MacLustr Vision iOS8 * File             : Scripts/portal/create-asc-record.js9 * Module           : Scripts10 * Repository       : https://git.spboucher.ai/maclustr-vision-ios11 * Project Website  : https://camera.spboucher.ai12 * Created          : 2026-11-3013 * Last Modified    : 2026-11-3014 *15 * Author           : Simon-Pierre Boucher16 * Position         : Professor of Finance17 * Institution      : Université du Québec en Outaouais (UQO)18 * Organization     : SP Boucher19 * Website          : https://spboucher.ai20 * Git              : https://git.spboucher.ai21 *22 * Preferred Contact: admin@spboucher.ai23 * Technical Contact: dev@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          : None specified (no license file in this repository)33 *34 * Do not embed credentials, private keys, access tokens,35 * certificates or confidential personal information.36 *37 * =============================================================================38 * END OF SP BOUCHER SOURCE HEADER39 * =============================================================================40 */4142// MacLustr Vision iOS — Scripts/portal/create-asc-record.js43// Crée la fiche App Store Connect (iOS, fr-CA) du bundle ai.spboucher.maclustrvision. Opération unique :44// relancée, elle signale que la fiche existe déjà.45// Author: Simon-Pierre Boucher — contact@spboucher.ai46async function create(bundleId, sku, names) {47  for (const name of names) {48    const body = {data:{type:"apps",attributes:{sku, primaryLocale:"fr-CA", bundleId},49      relationships:{appStoreVersions:{data:[{type:"appStoreVersions",id:"${store-version-ios}"}]},appInfos:{data:[{type:"appInfos",id:"${new-appInfo-id}"}]}}},50      included:[{type:"appStoreVersions",id:"${store-version-ios}",attributes:{platform:"IOS",versionString:"1.0.0"},relationships:{appStoreVersionLocalizations:{data:[{type:"appStoreVersionLocalizations",id:"${new-appStoreVersionLocalization-id}"}]}}},51        {type:"appStoreVersionLocalizations",id:"${new-appStoreVersionLocalization-id}",attributes:{locale:"fr-CA"}},52        {type:"appInfos",id:"${new-appInfo-id}",relationships:{appInfoLocalizations:{data:[{type:"appInfoLocalizations",id:"${new-appInfoLocalization-id}"}]}}},53        {type:"appInfoLocalizations",id:"${new-appInfoLocalization-id}",attributes:{locale:"fr-CA",name}}]};54    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)});55    const t = await r.text();56    if (r.status < 300) { const j = JSON.parse(t); return bundleId+' OK id='+j.data.id+' name='+name; }57    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)}})();58    if (!/name|NAME/.test(msg) || names.indexOf(name) === names.length-1) return bundleId+' FAIL '+r.status+' '+msg;59  }60}61async function main(){ return await create('ai.spboucher.maclustrvision','maclustrvision-ios-001',['MacLustr Vision','MacLustr Vision : caméras privées','MacLustr Vision NVR']); }62
Files main
Menu

Theme