Repository Public
1/**2 * =============================================================================3 * SP BOUCHER | SOFTWARE & RESEARCH4 * ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project : SP ID & Card Vault8 * File : scripts/portal/inventory.js9 * Module : Scripts10 * Repository : https://git.spboucher.ai/sp-id-card-vault11 * Project Website : Not specified12 * Created : 2026-12-0213 * Last Modified : 2026-12-0214 *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: contact@spboucher.ai23 * Development : dev@spboucher.ai24 * Support : support@spboucher.ai25 * Security/Admin : admin@spboucher.ai26 *27 * Copyright (c) 202628 * Simon-Pierre Boucher29 * All rights reserved where applicable. This file is governed by the30 * applicable project license, copyright notices and relevant law.31 * Existing third-party rights and notices remain unaffected.32 *33 * License : None specified (no license file in this repository)34 *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 */4243// Read-only: lists the App IDs matching ai.spboucher.idcardvault and their enabled capabilities.44async function main(){45 const team='3YM54G49SN';46 const get={'Content-Type':'application/vnd.api+json','Accept':'application/vnd.api+json, application/json','X-HTTP-Method-Override':'GET','X-Requested-With':'XMLHttpRequest'};47 const l=await (await fetch('/services-account/v1/bundleIds',{method:'POST',credentials:'include',headers:get,body:JSON.stringify({urlEncodedQueryParams:'limit=1000',teamId:team})})).json();48 if(!l.data) return 'STOP: no bundle id list ('+JSON.stringify(l).slice(0,200)+')';49 const out=[];50 for(const b of l.data.filter(d=>/^ai\.spboucher\.idcardvault/.test(d.attributes.identifier))){51 const d=await (await fetch('/services-account/v1/bundleIds/'+b.id,{method:'POST',credentials:'include',headers:get,body:JSON.stringify({urlEncodedQueryParams:'include=bundleIdCapabilities,bundleIdCapabilities.capability',teamId:team})})).json();52 const caps=(d.included||[]).filter(i=>i.type==='bundleIdCapabilities'&&i.attributes.enabled).map(i=>i.relationships.capability.data.id+(i.attributes.settings&&i.attributes.settings.length?JSON.stringify(i.attributes.settings.map(s=>[s.key,(s.options||[]).filter(o=>o.enabled!==false).map(o=>o.key)])):''));53 out.push({identifier:b.attributes.identifier,name:b.attributes.name,id:b.id,wildcard:b.attributes.wildcard,platform:b.attributes.platform,enabled:caps});54 }55 return JSON.stringify({team,totalBundleIds:l.data.length,appIDs:out});56}57