@composable-os/cli 0.1.0-beta.10 → 0.1.0-beta.13
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.
- package/dist/{accounts-X4CKM3HL.js → accounts-GOCNY6WI.js} +17 -14
- package/dist/app-RPRZMLU5.js +43 -0
- package/dist/app-upload-YJVEKZC6.js +198 -0
- package/dist/{blocks-YWDHEBOK.js → blocks-DE4RRWPJ.js} +207 -25
- package/dist/{chunk-VY64DMQO.js → chunk-2B6YUYZV.js} +23576 -11674
- package/dist/{run-RT2HVWMK.js → chunk-2CCHB37H.js} +9 -146
- package/dist/{chunk-DU6OIFOU.js → chunk-3OGDWKJ3.js} +530 -434
- package/dist/chunk-5D7BDF4Y.js +141 -0
- package/dist/{chunk-WO6D3XP3.js → chunk-6CM3WZG5.js} +13 -2470
- package/dist/chunk-CIBJGB5H.js +962 -0
- package/dist/chunk-EPDTPGZJ.js +330 -0
- package/dist/{chunk-LLULPZAJ.js → chunk-HAYF4G5V.js} +66 -23
- package/dist/chunk-HCG6T53D.js +61904 -0
- package/dist/chunk-JX4IFWNT.js +330 -0
- package/dist/{chunk-A4NTSYWV.js → chunk-KFHKNXGH.js} +786 -386
- package/dist/chunk-KMFMD52Z.js +13276 -0
- package/dist/{chunk-E4WCYTCT.js → chunk-LX2TTLVY.js} +174 -55
- package/dist/{chunk-GYTEW66E.js → chunk-O3R4FS2J.js} +1 -1
- package/dist/{chunk-LJFLENFC.js → chunk-Q6Y45DY6.js} +25 -2
- package/dist/{chunk-Y7JZFSTQ.js → chunk-QJZGYJVV.js} +823 -44
- package/dist/{chunk-6VXHPKGG.js → chunk-QQ3YSL5F.js} +172 -16
- package/dist/chunk-RGKJKC5T.js +876 -0
- package/dist/{chunk-IFG4FRW5.js → chunk-RSEWEFAV.js} +12 -2
- package/dist/{chunk-2ABSVMGB.js → chunk-SMJZIK2O.js} +1 -1
- package/dist/{chunk-CP6BXI6F.js → chunk-U72NEGCT.js} +8818 -3829
- package/dist/{chunk-WC5LHBBA.js → chunk-Z4IKF23A.js} +11 -7
- package/dist/chunk-Z7OVQ6BC.js +713 -0
- package/dist/{chunk-6UWRT4VM.js → chunk-ZJSFX4RD.js} +175 -3
- package/dist/{cli-2DFENR62.js → cli-OKQHHSOE.js} +17 -23
- package/dist/{cli-YIOVSKOD.js → cli-VYSD2S4Z.js} +231 -82
- package/dist/cli.js +5 -5
- package/dist/{client-repo-PRU3VCQQ.js → client-repo-NNUCHQ2Y.js} +7 -5
- package/dist/create.js +5 -5
- package/dist/{fields-2NC7LSYE.js → fields-GTHE6TTS.js} +27 -3
- package/dist/gateway-DPPEQZT4.js +25 -0
- package/dist/grants-6JY4XZO7.js +27 -0
- package/dist/invoke-MRONRZ5Q.js +33 -0
- package/dist/moves-UAUCMWL5.js +36 -0
- package/dist/{order-PUWD65BC.js → order-RKLGT74L.js} +2 -2
- package/dist/{person-WIQQ7ITU.js → person-YOZTFV4Q.js} +11 -11
- package/dist/plan-on-sale-H4F26YIN.js +26 -0
- package/dist/platform/migrations/0610_waitlists.sql +54 -0
- package/dist/platform/migrations/0630_subscription_changes.sql +122 -0
- package/dist/platform/migrations/0650_person_links.sql +90 -0
- package/dist/platform/migrations/0670_unmoved_guard.sql +52 -0
- package/dist/platform/migrations/0690_sellable_refund_due.sql +98 -0
- package/dist/platform/migrations/0730_practitioners.sql +79 -0
- package/dist/platform/migrations/0750_routine_mail.sql +98 -0
- package/dist/platform/migrations/0770_clear_fixed_role_grants.sql +64 -0
- package/dist/platform/migrations/0810_recurrence_exceptions.sql +66 -0
- package/dist/platform/migrations/0811_staff_time.sql +109 -0
- package/dist/platform/migrations/0812_staff_offers.sql +112 -0
- package/dist/platform/migrations/0813_pay_periods.sql +241 -0
- package/dist/platform/migrations/0814_staff_feed.sql +47 -0
- package/dist/platform/migrations/0815_checklists.sql +237 -0
- package/dist/platform/migrations/0816_checklist_schedules.sql +121 -0
- package/dist/platform/migrations/0817_checklist_day_window.sql +35 -0
- package/dist/platform/migrations/0850_agreements.sql +271 -0
- package/dist/platform/migrations/0851_agreement_acceptances.sql +387 -0
- package/dist/platform/migrations/0853_agreement_enforcement.sql +58 -0
- package/dist/platform/migrations/0854_agreement_copy.sql +149 -0
- package/dist/platform/migrations/0855_agreement_retention.sql +279 -0
- package/dist/platform/migrations/0856_subscription_cooling_off.sql +159 -0
- package/dist/platform/migrations/0857_agreement_copy_guardian.sql +337 -0
- package/dist/platform/migrations/0858_agreement_desk.sql +175 -0
- package/dist/platform/migrations/0910_routine_messages.sql +99 -0
- package/dist/platform/migrations/0911_texts.sql +60 -0
- package/dist/platform/migrations/0913_contact_consent.sql +93 -0
- package/dist/platform/migrations/0916_contact_mailbox_index.sql +29 -0
- package/dist/platform/migrations/0930_stock_movements.sql +95 -0
- package/dist/platform/migrations/0931_stock_low.sql +25 -0
- package/dist/platform/migrations/0932_order_delivery.sql +78 -0
- package/dist/platform/migrations/0950_order_adjustments.sql +111 -0
- package/dist/platform/migrations/0951_order_price_guards.sql +33 -0
- package/dist/platform/migrations/0952_order_paid_another_way.sql +194 -0
- package/dist/platform/migrations/0953_discount_uses.sql +183 -0
- package/dist/platform/migrations/0955_folded_addresses.sql +92 -0
- package/dist/platform/migrations/0970_published_text.sql +59 -0
- package/dist/platform/migrations/0971_publish_acks.sql +68 -0
- package/dist/platform/migrations/0990_customer_email_change.sql +65 -0
- package/dist/platform/migrations/1010_intake_links.sql +148 -0
- package/dist/platform/migrations/1030_invoices.sql +747 -0
- package/dist/platform/migrations/1031_invoice_orders.sql +327 -0
- package/dist/platform/migrations/1050_inbox_conversations.sql +83 -0
- package/dist/platform/migrations/1090_staff_hours.sql +43 -0
- package/dist/platform/migrations/1091_staff_time_margins.sql +12 -0
- package/dist/platform/migrations/1092_client_guard.sql +26 -0
- package/dist/platform/migrations/1095_thing_time.sql +70 -0
- package/dist/platform/migrations/1130_devices.sql +162 -0
- package/dist/platform/migrations/1135_person_codes.sql +88 -0
- package/dist/platform/migrations/1150_finance_periods.sql +316 -0
- package/dist/platform/migrations/1151_payouts.sql +202 -0
- package/dist/platform/migrations/1153_finance_money_dates.sql +18 -0
- package/dist/platform/migrations/1170_journeys.sql +318 -0
- package/dist/platform/migrations/1171_person_birthday.sql +52 -0
- package/dist/platform/migrations/1175_person_signals.sql +29 -0
- package/dist/platform/migrations/1190_restricted_values.sql +25 -0
- package/dist/platform/migrations/1230_note_levels.sql +113 -0
- package/dist/platform/migrations/1231_person_carers.sql +33 -0
- package/dist/platform/migrations/1232_note_kinds.sql +122 -0
- package/dist/platform/migrations/1270_time_entries.sql +145 -0
- package/dist/platform/migrations/1271_leave.sql +249 -0
- package/dist/platform/migrations/1273_time_entry_reopened.sql +21 -0
- package/dist/platform/migrations/1330_accounting.sql +260 -0
- package/dist/platform/migrations/1350_customer_feed.sql +24 -0
- package/dist/platform/migrations/1390_locations.sql +77 -0
- package/dist/platform/migrations/1410_outside_copy.sql +213 -0
- package/dist/platform/migrations/1430_inbox_activities.sql +231 -0
- package/dist/platform/migrations/1450_wrong_guesses.sql +23 -0
- package/dist/platform/sdk/acknowledge.ts +100 -0
- package/dist/platform/sdk/agreements.ts +185 -0
- package/dist/platform/sdk/allowance.ts +98 -8
- package/dist/platform/sdk/automation-check.ts +120 -9
- package/dist/platform/sdk/automation.ts +78 -10
- package/dist/platform/sdk/behaviour.ts +26 -6
- package/dist/platform/sdk/calendar-entry.ts +258 -0
- package/dist/platform/sdk/capacity.ts +103 -2
- package/dist/platform/sdk/checklists.ts +118 -0
- package/dist/platform/sdk/contract.ts +514 -27
- package/dist/platform/sdk/discount.ts +408 -0
- package/dist/platform/sdk/document.ts +4 -2
- package/dist/platform/sdk/field-types.ts +5 -0
- package/dist/platform/sdk/formula/compile.ts +10 -0
- package/dist/platform/sdk/index.ts +17 -0
- package/dist/platform/sdk/intake.ts +380 -0
- package/dist/platform/sdk/journey-signals.ts +215 -0
- package/dist/platform/sdk/manifest.ts +1313 -66
- package/dist/platform/sdk/mine.ts +161 -0
- package/dist/platform/sdk/occupies.ts +192 -0
- package/dist/platform/sdk/questions.ts +681 -0
- package/dist/platform/sdk/recurring.ts +90 -9
- package/dist/platform/sdk/restricted-fields.ts +129 -0
- package/dist/platform/sdk/rich-text.ts +112 -0
- package/dist/platform/sdk/routine-mail.ts +1272 -0
- package/dist/platform/sdk/runtime.ts +25 -12
- package/dist/platform/sdk/screens.ts +91 -0
- package/dist/platform/sdk/sellable.ts +595 -1
- package/dist/platform/sdk/slug.ts +7 -2
- package/dist/platform/sdk/staffed.ts +474 -0
- package/dist/platform/sdk/states.ts +220 -64
- package/dist/platform/sdk/stock.ts +332 -0
- package/dist/platform/sdk/team.ts +83 -0
- package/dist/platform/sdk/testing.ts +70 -6
- package/dist/platform/sdk/worked-on.ts +134 -0
- package/dist/{products-2H5DR232.js → products-GCQLSZ3U.js} +2 -2
- package/dist/run-7ID64RA6.js +65 -0
- package/dist/run-FH7OGGTV.js +131 -0
- package/dist/run-OYZIAP6M.js +3363 -0
- package/dist/{run-Y7T4TVOL.js → run-QOFRRSZV.js} +41 -60
- package/dist/{run-PZUCSDDL.js → run-TJAEWR5U.js} +21 -51
- package/dist/{src-XTOD7EXW.js → src-52VERUPK.js} +312 -4
- package/dist/src-PHRELWN5.js +40 -0
- package/dist/visibility-SZCINPP4.js +58 -0
- package/package.json +2 -2
- package/dist/chunk-6GDEDOV7.js +0 -157
- package/dist/chunk-6UPUF4ML.js +0 -29998
- package/dist/chunk-7CQGMVDO.js +0 -63
- package/dist/chunk-GYSGVT6R.js +0 -284
- package/dist/chunk-JJHHNV46.js +0 -227
- package/dist/chunk-K6T42YCH.js +0 -704
- package/dist/chunk-M7A6FR2Z.js +0 -2586
- package/dist/chunk-O2UIZHND.js +0 -249
- package/dist/chunk-Q4N55M2Z.js +0 -552
- package/dist/chunk-QGGJ2G6Z.js +0 -349
- package/dist/chunk-R4W5XAUD.js +0 -837
- package/dist/chunk-TQFGGSA4.js +0 -748
- package/dist/chunk-YJJHF65I.js +0 -759
- package/dist/chunk-Z3RMMB6S.js +0 -668
- package/dist/grants-QXMKYMGB.js +0 -32
- package/dist/invoke-I3NNNXVL.js +0 -39
- package/dist/plan-on-sale-NB774CQL.js +0 -26
- package/dist/src-GYS6NBQB.js +0 -44
- package/dist/visibility-DLGHU4YN.js +0 -33
|
@@ -5,6 +5,8 @@ import {
|
|
|
5
5
|
customerCodeReason,
|
|
6
6
|
customerMayGetCode,
|
|
7
7
|
customerSignedInStatement,
|
|
8
|
+
foldAddress,
|
|
9
|
+
foldedSql,
|
|
8
10
|
hasBought,
|
|
9
11
|
inviteCustomer,
|
|
10
12
|
inviteCustomerStatement,
|
|
@@ -13,20 +15,18 @@ import {
|
|
|
13
15
|
loadCustomerByEmail,
|
|
14
16
|
loadCustomerSignIn,
|
|
15
17
|
normaliseCustomerEmail,
|
|
16
|
-
sameEmailPeople
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-6GDEDOV7.js";
|
|
21
|
-
import "./chunk-QGGJ2G6Z.js";
|
|
22
|
-
import "./chunk-K6T42YCH.js";
|
|
23
|
-
import "./chunk-TQFGGSA4.js";
|
|
18
|
+
sameEmailPeople,
|
|
19
|
+
samePeople
|
|
20
|
+
} from "./chunk-2B6YUYZV.js";
|
|
21
|
+
import "./chunk-KMFMD52Z.js";
|
|
24
22
|
import "./chunk-KGHA67HG.js";
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
28
|
-
import "./chunk-
|
|
29
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-ZJSFX4RD.js";
|
|
24
|
+
import "./chunk-KFHKNXGH.js";
|
|
25
|
+
import "./chunk-RSEWEFAV.js";
|
|
26
|
+
import "./chunk-CIBJGB5H.js";
|
|
27
|
+
import "./chunk-U72NEGCT.js";
|
|
28
|
+
import "./chunk-Q6Y45DY6.js";
|
|
29
|
+
import "./chunk-RGKJKC5T.js";
|
|
30
30
|
import "./chunk-5KSXSK7Y.js";
|
|
31
31
|
export {
|
|
32
32
|
CUSTOMER_LINK_AUDIT,
|
|
@@ -34,6 +34,8 @@ export {
|
|
|
34
34
|
customerCodeReason,
|
|
35
35
|
customerMayGetCode,
|
|
36
36
|
customerSignedInStatement,
|
|
37
|
+
foldAddress,
|
|
38
|
+
foldedSql,
|
|
37
39
|
hasBought,
|
|
38
40
|
inviteCustomer,
|
|
39
41
|
inviteCustomerStatement,
|
|
@@ -42,5 +44,6 @@ export {
|
|
|
42
44
|
loadCustomerByEmail,
|
|
43
45
|
loadCustomerSignIn,
|
|
44
46
|
normaliseCustomerEmail,
|
|
45
|
-
sameEmailPeople
|
|
47
|
+
sameEmailPeople,
|
|
48
|
+
samePeople
|
|
46
49
|
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
APP_SECRETS,
|
|
4
|
+
APP_USAGE,
|
|
5
|
+
LISTING_FILES,
|
|
6
|
+
RECORD_ENVIRONMENT,
|
|
7
|
+
UPLOAD_ENVIRONMENT,
|
|
8
|
+
brandPath,
|
|
9
|
+
brandText,
|
|
10
|
+
buildFor,
|
|
11
|
+
envFlag,
|
|
12
|
+
generatedApiVersion,
|
|
13
|
+
keyFiles,
|
|
14
|
+
listingLocales,
|
|
15
|
+
listingText,
|
|
16
|
+
pngInfo,
|
|
17
|
+
runApp,
|
|
18
|
+
writeBrand
|
|
19
|
+
} from "./chunk-QJZGYJVV.js";
|
|
20
|
+
import "./chunk-QQ3YSL5F.js";
|
|
21
|
+
import "./chunk-3OGDWKJ3.js";
|
|
22
|
+
import "./chunk-KGHA67HG.js";
|
|
23
|
+
import "./chunk-SMJZIK2O.js";
|
|
24
|
+
import "./chunk-ZJSFX4RD.js";
|
|
25
|
+
import "./chunk-5KSXSK7Y.js";
|
|
26
|
+
export {
|
|
27
|
+
APP_SECRETS,
|
|
28
|
+
APP_USAGE,
|
|
29
|
+
LISTING_FILES,
|
|
30
|
+
RECORD_ENVIRONMENT,
|
|
31
|
+
UPLOAD_ENVIRONMENT,
|
|
32
|
+
brandPath,
|
|
33
|
+
brandText,
|
|
34
|
+
buildFor,
|
|
35
|
+
envFlag,
|
|
36
|
+
generatedApiVersion,
|
|
37
|
+
keyFiles,
|
|
38
|
+
listingLocales,
|
|
39
|
+
listingText,
|
|
40
|
+
pngInfo,
|
|
41
|
+
runApp,
|
|
42
|
+
writeBrand
|
|
43
|
+
};
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
buildFor,
|
|
4
|
+
envFlag,
|
|
5
|
+
listingLocales,
|
|
6
|
+
listingText,
|
|
7
|
+
loadClientProduct
|
|
8
|
+
} from "./chunk-QJZGYJVV.js";
|
|
9
|
+
import {
|
|
10
|
+
CliError,
|
|
11
|
+
str
|
|
12
|
+
} from "./chunk-QQ3YSL5F.js";
|
|
13
|
+
import "./chunk-3OGDWKJ3.js";
|
|
14
|
+
import "./chunk-KGHA67HG.js";
|
|
15
|
+
import "./chunk-SMJZIK2O.js";
|
|
16
|
+
import "./chunk-ZJSFX4RD.js";
|
|
17
|
+
import "./chunk-5KSXSK7Y.js";
|
|
18
|
+
|
|
19
|
+
// src/app-upload.ts
|
|
20
|
+
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
21
|
+
import { resolve } from "node:path";
|
|
22
|
+
var STORE_API = "https://androidpublisher.googleapis.com";
|
|
23
|
+
var SCOPE = "https://www.googleapis.com/auth/androidpublisher";
|
|
24
|
+
var TESTING_TRACK = "internal";
|
|
25
|
+
var base64url = (bytes) => Buffer.from(bytes).toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
26
|
+
async function accessToken(account, fetcher) {
|
|
27
|
+
const der = Buffer.from(
|
|
28
|
+
account.private_key.replace(/-----[^-]+-----/g, "").replace(/\s+/g, ""),
|
|
29
|
+
"base64"
|
|
30
|
+
);
|
|
31
|
+
const key = await crypto.subtle.importKey(
|
|
32
|
+
"pkcs8",
|
|
33
|
+
der,
|
|
34
|
+
{ name: "RSASSA-PKCS1-v1_5", hash: "SHA-256" },
|
|
35
|
+
false,
|
|
36
|
+
["sign"]
|
|
37
|
+
);
|
|
38
|
+
const now = Math.floor(Date.now() / 1e3);
|
|
39
|
+
const unsigned = `${base64url(JSON.stringify({ alg: "RS256", typ: "JWT" }))}.${base64url(
|
|
40
|
+
JSON.stringify({
|
|
41
|
+
iss: account.client_email,
|
|
42
|
+
scope: SCOPE,
|
|
43
|
+
aud: account.token_uri,
|
|
44
|
+
iat: now,
|
|
45
|
+
exp: now + 600
|
|
46
|
+
})
|
|
47
|
+
)}`;
|
|
48
|
+
const signature = new Uint8Array(
|
|
49
|
+
await crypto.subtle.sign("RSASSA-PKCS1-v1_5", key, new TextEncoder().encode(unsigned))
|
|
50
|
+
);
|
|
51
|
+
const response = await fetcher(account.token_uri, {
|
|
52
|
+
method: "POST",
|
|
53
|
+
headers: { "content-type": "application/x-www-form-urlencoded" },
|
|
54
|
+
body: new URLSearchParams({
|
|
55
|
+
grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer",
|
|
56
|
+
assertion: `${unsigned}.${base64url(signature)}`
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
const body = await response.json().catch(() => ({}));
|
|
60
|
+
if (!response.ok || !body.access_token) {
|
|
61
|
+
throw new CliError(
|
|
62
|
+
`The Android store refused the upload account key (${response.status}): check ANDROID_STORE_SERVICE_ACCOUNT and its access in the client's store account.`
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
return body.access_token;
|
|
66
|
+
}
|
|
67
|
+
function serviceAccount(deps) {
|
|
68
|
+
const text = deps.env.ANDROID_STORE_SERVICE_ACCOUNT;
|
|
69
|
+
if (!text?.trim()) {
|
|
70
|
+
throw new CliError(
|
|
71
|
+
"ANDROID_STORE_SERVICE_ACCOUNT is not set: a person sets it as a CI secret (cos app credentials)."
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
let account;
|
|
75
|
+
try {
|
|
76
|
+
account = JSON.parse(text);
|
|
77
|
+
} catch {
|
|
78
|
+
throw new CliError("ANDROID_STORE_SERVICE_ACCOUNT is not the upload account's JSON key.");
|
|
79
|
+
}
|
|
80
|
+
if (!account.client_email || !account.private_key || !account.token_uri) {
|
|
81
|
+
throw new CliError(
|
|
82
|
+
"ANDROID_STORE_SERVICE_ACCOUNT has no client_email, private_key or token_uri: it is not the upload account's JSON key."
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
deps.redactor.add(account.private_key);
|
|
86
|
+
return account;
|
|
87
|
+
}
|
|
88
|
+
async function uploadAndroid(upload2, account, options = {}) {
|
|
89
|
+
const fetcher = options.fetch ?? fetch;
|
|
90
|
+
const api = options.api ?? STORE_API;
|
|
91
|
+
const token = await accessToken(account, fetcher);
|
|
92
|
+
const app = `applications/${encodeURIComponent(upload2.packageName)}`;
|
|
93
|
+
const call = async (method, path, body, raw) => {
|
|
94
|
+
const response = await fetcher(`${api}${path}`, {
|
|
95
|
+
method,
|
|
96
|
+
headers: {
|
|
97
|
+
authorization: `Bearer ${token}`,
|
|
98
|
+
"content-type": raw ? "application/octet-stream" : "application/json"
|
|
99
|
+
},
|
|
100
|
+
...raw ? { body: raw } : body === void 0 ? {} : { body: JSON.stringify(body) }
|
|
101
|
+
});
|
|
102
|
+
const text = await response.text();
|
|
103
|
+
if (!response.ok) {
|
|
104
|
+
const message = (() => {
|
|
105
|
+
try {
|
|
106
|
+
return JSON.parse(text).error?.message;
|
|
107
|
+
} catch {
|
|
108
|
+
return void 0;
|
|
109
|
+
}
|
|
110
|
+
})();
|
|
111
|
+
throw new CliError(
|
|
112
|
+
`The Android store refused ${method} ${path.replace(/\/edits\/[^/:]+/, "/edits/\u2026")} (${response.status})${message ? `: ${message}` : ""}. Nothing was committed.`
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
return text ? JSON.parse(text) : {};
|
|
116
|
+
};
|
|
117
|
+
const edit = await call("POST", `/androidpublisher/v3/${app}/edits`, {});
|
|
118
|
+
const editPath = `/androidpublisher/v3/${app}/edits/${encodeURIComponent(edit.id)}`;
|
|
119
|
+
const bundle = await call(
|
|
120
|
+
"POST",
|
|
121
|
+
`/upload/androidpublisher/v3/${app}/edits/${encodeURIComponent(edit.id)}/bundles?uploadType=media`,
|
|
122
|
+
void 0,
|
|
123
|
+
upload2.bundle
|
|
124
|
+
);
|
|
125
|
+
for (const listing of upload2.listings ?? []) {
|
|
126
|
+
await call("PUT", `${editPath}/listings/${encodeURIComponent(listing.language)}`, listing);
|
|
127
|
+
}
|
|
128
|
+
await call("PUT", `${editPath}/tracks/${TESTING_TRACK}`, {
|
|
129
|
+
track: TESTING_TRACK,
|
|
130
|
+
releases: [
|
|
131
|
+
{
|
|
132
|
+
versionCodes: [String(bundle.versionCode)],
|
|
133
|
+
status: upload2.draft ? "draft" : "completed",
|
|
134
|
+
releaseNotes: upload2.releaseNotes
|
|
135
|
+
}
|
|
136
|
+
]
|
|
137
|
+
});
|
|
138
|
+
await call("POST", `${editPath}:commit`);
|
|
139
|
+
return bundle.versionCode;
|
|
140
|
+
}
|
|
141
|
+
async function upload(flags, deps) {
|
|
142
|
+
const platform = str(flags, "platform");
|
|
143
|
+
if (platform === "ios") {
|
|
144
|
+
throw new CliError(
|
|
145
|
+
"The iPhone build is sent by the app workflow with the platform's own upload tool; cos app upload sends the Android build."
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
if (platform !== "android")
|
|
149
|
+
throw new CliError("cos app upload --platform android --file <app.aab>.");
|
|
150
|
+
const file = str(flags, "file");
|
|
151
|
+
if (!file?.endsWith(".aab")) throw new CliError("--file is the Android app bundle (.aab).");
|
|
152
|
+
const root = resolve(str(flags, "dir") ?? process.cwd());
|
|
153
|
+
const product = await loadClientProduct(root);
|
|
154
|
+
if (!product.mobile) throw new CliError("product.ts has no mobile app (mobile: { dir }).");
|
|
155
|
+
const build = buildFor(product, envFlag(product, flags));
|
|
156
|
+
if (!build.store) throw new CliError("product.ts gives no mobile.app.");
|
|
157
|
+
const { listing } = build.store;
|
|
158
|
+
const locales = listingLocales(root, listing);
|
|
159
|
+
if (!locales.length) throw new CliError(`${listing} has no locale folder: run cos app check.`);
|
|
160
|
+
const text = (locale, name) => listingText(root, listing, locale, name) ?? "";
|
|
161
|
+
const path = resolve(file);
|
|
162
|
+
if (!existsSync(path) || !statSync(path).isFile()) throw new CliError(`There is no ${file}.`);
|
|
163
|
+
const account = serviceAccount(deps);
|
|
164
|
+
const env = deps.env;
|
|
165
|
+
const versionCode = await uploadAndroid(
|
|
166
|
+
{
|
|
167
|
+
packageName: build.store.ids.android,
|
|
168
|
+
bundle: new Uint8Array(readFileSync(path)),
|
|
169
|
+
...flags.listing ? {
|
|
170
|
+
listings: locales.map((language) => ({
|
|
171
|
+
language,
|
|
172
|
+
title: text(language, "name.txt"),
|
|
173
|
+
shortDescription: text(language, "subtitle.txt"),
|
|
174
|
+
fullDescription: text(language, "description.txt")
|
|
175
|
+
}))
|
|
176
|
+
} : {},
|
|
177
|
+
releaseNotes: locales.map((language) => ({
|
|
178
|
+
language,
|
|
179
|
+
text: text(language, "release-notes.txt")
|
|
180
|
+
})),
|
|
181
|
+
draft: Boolean(flags.draft)
|
|
182
|
+
},
|
|
183
|
+
account,
|
|
184
|
+
{
|
|
185
|
+
...env.COS_ANDROID_STORE_API ? { api: env.COS_ANDROID_STORE_API } : {},
|
|
186
|
+
...deps.fetch ? { fetch: deps.fetch } : {}
|
|
187
|
+
}
|
|
188
|
+
);
|
|
189
|
+
deps.io.out(
|
|
190
|
+
`Sent ${build.store.ids.android} build ${versionCode} to the Android store's ${TESTING_TRACK} testing track${flags.listing ? ", with the listing" : ""}${flags.draft ? " (a draft release)" : ""}. Nothing is released to the public: a person does that in the store's console after the client's yes.`
|
|
191
|
+
);
|
|
192
|
+
return 0;
|
|
193
|
+
}
|
|
194
|
+
export {
|
|
195
|
+
TESTING_TRACK,
|
|
196
|
+
upload,
|
|
197
|
+
uploadAndroid
|
|
198
|
+
};
|
|
@@ -2,16 +2,17 @@
|
|
|
2
2
|
import {
|
|
3
3
|
fetchKit,
|
|
4
4
|
lineDiff,
|
|
5
|
-
loadClientProduct
|
|
6
|
-
|
|
5
|
+
loadClientProduct,
|
|
6
|
+
requiredPacks
|
|
7
|
+
} from "./chunk-QJZGYJVV.js";
|
|
7
8
|
import {
|
|
8
9
|
CliError,
|
|
9
10
|
str
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-QQ3YSL5F.js";
|
|
12
|
+
import "./chunk-3OGDWKJ3.js";
|
|
12
13
|
import "./chunk-KGHA67HG.js";
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-SMJZIK2O.js";
|
|
15
|
+
import "./chunk-ZJSFX4RD.js";
|
|
15
16
|
import "./chunk-5KSXSK7Y.js";
|
|
16
17
|
|
|
17
18
|
// src/blocks.ts
|
|
@@ -53,7 +54,8 @@ ${listBlocks(kit)}`);
|
|
|
53
54
|
function installCommand(root, app, packages) {
|
|
54
55
|
const cd = app && app !== "." ? `cd ${app} && ` : "";
|
|
55
56
|
const appJson = join(root, app, "app.json");
|
|
56
|
-
|
|
57
|
+
const expo = existsSync(appJson) && /"expo"\s*:/.test(readFileSync(appJson, "utf8")) || ["app.config.ts", "app.config.js"].some((f) => existsSync(join(root, app, f)));
|
|
58
|
+
if (expo) {
|
|
57
59
|
return `${cd}npx expo install ${packages.join(" ")}`;
|
|
58
60
|
}
|
|
59
61
|
const at = (file) => existsSync(join(root, file)) || existsSync(join(root, app, file));
|
|
@@ -61,24 +63,152 @@ function installCommand(root, app, packages) {
|
|
|
61
63
|
return `${cd}${manager} ${packages.join(" ")}`;
|
|
62
64
|
}
|
|
63
65
|
var blockDir = (app, name) => join(app, "src", "blocks", name);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
66
|
+
var ACCOUNT_SHELLS = { web: "web-account", native: "native-account" };
|
|
67
|
+
var ACCOUNT_SECTIONS_FILE = "account-sections.gen.ts";
|
|
68
|
+
function kitPortal(kit) {
|
|
69
|
+
const file = kit.get("contract/roles.json");
|
|
70
|
+
if (!file) return {};
|
|
71
|
+
return JSON.parse(decode(file)).portal ?? {};
|
|
72
|
+
}
|
|
73
|
+
function sectionsFor(kit, packs, skin) {
|
|
74
|
+
const portal = kitPortal(kit);
|
|
75
|
+
return packs.flatMap(
|
|
76
|
+
(pack) => Object.entries(portal[pack]?.sections ?? {}).flatMap(([key, section]) => {
|
|
77
|
+
const named = section[skin];
|
|
78
|
+
if (!named) return [];
|
|
79
|
+
return [
|
|
80
|
+
{
|
|
81
|
+
key: `${pack}.${key}`,
|
|
82
|
+
pack,
|
|
83
|
+
label: section.label,
|
|
84
|
+
order: section.order,
|
|
85
|
+
block: named.block,
|
|
86
|
+
export: named.export,
|
|
87
|
+
hooks: portal[pack]?.hooks
|
|
88
|
+
}
|
|
89
|
+
];
|
|
90
|
+
})
|
|
91
|
+
).sort((a, b) => a.order - b.order || a.key.localeCompare(b.key));
|
|
92
|
+
}
|
|
93
|
+
var exportsName = (text, name) => new RegExp(`\\bexport\\s+(?:async\\s+)?(?:function|const|let|class)\\s+${name}\\b`).test(text) || new RegExp(`\\bexport\\s*\\{[^}]*\\b${name}\\b[^}]*\\}`).test(text);
|
|
94
|
+
function fileExporting(kit, block, name) {
|
|
95
|
+
for (const file of blockManifest(kit, block).files) {
|
|
96
|
+
const bytes = kit.get(`blocks/${block}/${file}`);
|
|
97
|
+
if (bytes && /\.[jt]sx?$/.test(file) && exportsName(decode(bytes), name)) return file;
|
|
78
98
|
}
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
function accountSectionsSource(sections, skin) {
|
|
102
|
+
const shell = ACCOUNT_SHELLS[skin];
|
|
103
|
+
const shellFile = skin === "web" ? "account.tsx" : "account-screen.tsx";
|
|
104
|
+
const entryType = skin === "web" ? "WebSectionEntry" : "NativeSectionEntry";
|
|
105
|
+
const hooks = [...new Map(sections.map((s) => [s.pack, s.hooks])).entries()];
|
|
106
|
+
const components = sections;
|
|
107
|
+
const lines = [
|
|
108
|
+
"// Generated by `cos add` and `cos upgrade` from the packs product.ts lists (stage 48, ADR 0710):",
|
|
109
|
+
"// each section of My account a pack declares, as its copied block's component and the pack's",
|
|
110
|
+
"// hooks. Do not edit: it is written again. The blocks it names are yours (cos diff <block>).",
|
|
111
|
+
...hooks.map(
|
|
112
|
+
([pack, factory]) => `import { ${factory} } from "@composable-os/pack-${pack}/client";`
|
|
113
|
+
),
|
|
114
|
+
...components.map((c) => `import { ${c.export} } from "./${c.block}/${c.file}";`),
|
|
115
|
+
`import type { ${entryType} } from "./${shell}/${shellFile}";`,
|
|
116
|
+
"",
|
|
117
|
+
`export const ACCOUNT_SECTIONS: readonly ${entryType}[] = [`,
|
|
118
|
+
...components.flatMap((c) => [
|
|
119
|
+
" {",
|
|
120
|
+
` key: ${JSON.stringify(c.key)},`,
|
|
121
|
+
` pack: ${JSON.stringify(c.pack)},`,
|
|
122
|
+
` label: ${JSON.stringify(c.label)},`,
|
|
123
|
+
` order: ${c.order},`,
|
|
124
|
+
` component: ${c.export},`,
|
|
125
|
+
` hooks: ${c.hooks},`,
|
|
126
|
+
" },"
|
|
127
|
+
]),
|
|
128
|
+
"];",
|
|
129
|
+
""
|
|
130
|
+
];
|
|
131
|
+
return lines.join("\n");
|
|
132
|
+
}
|
|
133
|
+
function writeAccountSections(root, product, kit, lock) {
|
|
134
|
+
const packs = [...product.packs, ...requiredPacks(kit, product.packs)];
|
|
135
|
+
const missing = [];
|
|
136
|
+
const unwired = [];
|
|
137
|
+
for (const skin of ["web", "native"]) {
|
|
138
|
+
const shell = lock[ACCOUNT_SHELLS[skin]];
|
|
139
|
+
if (!shell) continue;
|
|
140
|
+
const sections = sectionsFor(kit, packs, skin);
|
|
141
|
+
for (const s of sections) if (!lock[s.block]) missing.push(s.block);
|
|
142
|
+
const wired = [];
|
|
143
|
+
for (const s of sections) {
|
|
144
|
+
const copy = lock[s.block];
|
|
145
|
+
if (!copy) continue;
|
|
146
|
+
const file2 = fileExporting(kit, s.block, s.export);
|
|
147
|
+
if (!file2) throw new CliError(`The release's ${s.block} exports no ${s.export}.`);
|
|
148
|
+
const path = join(root, blockDir(copy.app, s.block), file2);
|
|
149
|
+
if (existsSync(path) && exportsName(readFileSync(path, "utf8"), s.export)) {
|
|
150
|
+
wired.push({ ...s, file: file2 });
|
|
151
|
+
} else {
|
|
152
|
+
unwired.push({
|
|
153
|
+
key: s.key,
|
|
154
|
+
label: s.label,
|
|
155
|
+
block: s.block,
|
|
156
|
+
file: file2,
|
|
157
|
+
export: s.export,
|
|
158
|
+
app: copy.app,
|
|
159
|
+
shell: ACCOUNT_SHELLS[skin]
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
const file = join(root, shell.app, "src", "blocks", ACCOUNT_SECTIONS_FILE);
|
|
164
|
+
mkdirSync(dirname(file), { recursive: true });
|
|
165
|
+
writeFileSync(file, accountSectionsSource(wired, skin));
|
|
166
|
+
}
|
|
167
|
+
return { missing, unwired };
|
|
168
|
+
}
|
|
169
|
+
function unwiredWords(unwired) {
|
|
170
|
+
return unwired.map(
|
|
171
|
+
(s) => `My account's "${s.label}" section is not wired: your copy of ${s.block} (${blockDir(s.app, s.block)}/${s.file}) does not export ${s.export}, which this release's section draws, so the copy is older than the release's block (or was edited). cos diff ${s.block} shows what changed upstream; apply it by hand, then run cos add ${s.shell} to wire the section. Until then the shell leaves it out.`
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
function changedBlocks(root, kit) {
|
|
79
175
|
const lock = readLock(root);
|
|
176
|
+
const out = [];
|
|
177
|
+
for (const [name, entry] of Object.entries(lock).sort(([a], [b]) => a.localeCompare(b))) {
|
|
178
|
+
if (!kit.get(`blocks/${name}/block.json`)) {
|
|
179
|
+
out.push({ name, files: [], newDependencies: [], gone: true });
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
const manifest = blockManifest(kit, name);
|
|
183
|
+
const files = [.../* @__PURE__ */ new Set([...Object.keys(entry.files), ...manifest.files])].sort().filter((file) => {
|
|
184
|
+
const bytes = kit.get(`blocks/${name}/${file}`);
|
|
185
|
+
return !bytes || sha(bytes) !== entry.files[file];
|
|
186
|
+
});
|
|
187
|
+
const newDependencies = manifest.dependsOn.filter((dep) => !lock[dep]);
|
|
188
|
+
if (files.length || newDependencies.length) {
|
|
189
|
+
out.push({ name, files, newDependencies, gone: false });
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return out;
|
|
193
|
+
}
|
|
194
|
+
function changedBlocksWords(changed, version) {
|
|
195
|
+
if (!changed.length) return [];
|
|
196
|
+
return [
|
|
197
|
+
`
|
|
198
|
+
Copied blocks that changed upstream in ${version} since they were copied. Your copies are not touched; cos diff <block> shows each change:`,
|
|
199
|
+
...changed.map(
|
|
200
|
+
(b) => b.gone ? ` ${b.name}: no longer in the release` : ` ${b.name}: ${[
|
|
201
|
+
b.files.length ? `${b.files.join(", ")} changed` : "",
|
|
202
|
+
...b.newDependencies.map((dep) => `now depends on ${dep} (cos add ${dep})`)
|
|
203
|
+
].filter(Boolean).join("; ")}`
|
|
204
|
+
)
|
|
205
|
+
];
|
|
206
|
+
}
|
|
207
|
+
function copyBlocks(root, product, kit, version, names, lock) {
|
|
208
|
+
const packs = [...product.packs, ...requiredPacks(kit, product.packs)];
|
|
80
209
|
const added = [];
|
|
81
210
|
const needs = /* @__PURE__ */ new Map();
|
|
211
|
+
const apps = [];
|
|
82
212
|
const visit = (block, trail) => {
|
|
83
213
|
if (lock[block] || added.includes(block)) return;
|
|
84
214
|
if (trail.includes(block))
|
|
@@ -90,7 +220,7 @@ async function add(argv, flags, deps) {
|
|
|
90
220
|
`${block} is a ${manifest.skin} block and this repo has no ${manifest.skin === "web" ? "web" : "mobile"} app in product.ts.`
|
|
91
221
|
);
|
|
92
222
|
}
|
|
93
|
-
if (manifest.pack && !
|
|
223
|
+
if (manifest.pack && !packs.includes(manifest.pack)) {
|
|
94
224
|
throw new CliError(
|
|
95
225
|
`${block} is a block of the ${manifest.pack} pack, which product.ts does not list.`
|
|
96
226
|
);
|
|
@@ -113,8 +243,32 @@ async function add(argv, flags, deps) {
|
|
|
113
243
|
}
|
|
114
244
|
if (!apps.includes(app)) apps.push(app);
|
|
115
245
|
};
|
|
116
|
-
const
|
|
117
|
-
|
|
246
|
+
for (const name of names) visit(name, []);
|
|
247
|
+
let written = { missing: [], unwired: [] };
|
|
248
|
+
if (Object.values(ACCOUNT_SHELLS).some((shell) => lock[shell])) {
|
|
249
|
+
for (const block of writeAccountSections(root, product, kit, lock).missing) visit(block, []);
|
|
250
|
+
written = writeAccountSections(root, product, kit, lock);
|
|
251
|
+
}
|
|
252
|
+
return { added, needs, apps, ...written };
|
|
253
|
+
}
|
|
254
|
+
var saveLock = writeLock;
|
|
255
|
+
async function add(argv, flags, deps) {
|
|
256
|
+
const name = argv[0];
|
|
257
|
+
const root = resolve(str(flags, "dir") ?? process.cwd());
|
|
258
|
+
const product = await loadClientProduct(root);
|
|
259
|
+
const { kit, version } = await fetchKit(
|
|
260
|
+
flags,
|
|
261
|
+
deps,
|
|
262
|
+
product.platform.release,
|
|
263
|
+
product.platform.repository,
|
|
264
|
+
product.platform.version
|
|
265
|
+
);
|
|
266
|
+
if (!name) {
|
|
267
|
+
deps.io.out(listBlocks(kit));
|
|
268
|
+
return 0;
|
|
269
|
+
}
|
|
270
|
+
const lock = readLock(root);
|
|
271
|
+
const { added, needs, apps, unwired } = copyBlocks(root, product, kit, version, [name], lock);
|
|
118
272
|
writeLock(root, lock);
|
|
119
273
|
if (needs.size) {
|
|
120
274
|
const app = apps[0];
|
|
@@ -130,8 +284,26 @@ async function add(argv, flags, deps) {
|
|
|
130
284
|
deps.io.out(
|
|
131
285
|
added.length ? `Copied ${added.join(", ")} (${version}) into ${added.map((b) => blockDir(lock[b]?.app ?? "", b)).join(", ")}. The files are yours now; ${LOCK} records where they came from.` : `${name} is already copied (${LOCK}).`
|
|
132
286
|
);
|
|
287
|
+
for (const shell of Object.values(ACCOUNT_SHELLS).filter((s) => lock[s])) {
|
|
288
|
+
const app = lock[shell]?.app ?? "";
|
|
289
|
+
deps.io.out(
|
|
290
|
+
`My account's sections: ${join(app, "src", "blocks", ACCOUNT_SECTIONS_FILE)} names the packs' sections; written again by cos add and cos upgrade.`
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
for (const line of unwiredWords(unwired)) deps.io.out(line);
|
|
133
294
|
return 0;
|
|
134
295
|
}
|
|
296
|
+
function rewriteAccountSections(root, product, kit, version, io) {
|
|
297
|
+
const lock = readLock(root);
|
|
298
|
+
if (Object.values(ACCOUNT_SHELLS).some((shell) => lock[shell])) {
|
|
299
|
+
const { missing, unwired } = writeAccountSections(root, product, kit, lock);
|
|
300
|
+
io.out(
|
|
301
|
+
missing.length ? `My account's sections written again; the release has sections not copied yet (${missing.join(", ")}): run cos add web-account to copy them.` : "My account's sections written again."
|
|
302
|
+
);
|
|
303
|
+
for (const line of unwiredWords(unwired)) io.out(line);
|
|
304
|
+
}
|
|
305
|
+
for (const line of changedBlocksWords(changedBlocks(root, kit), version)) io.out(line);
|
|
306
|
+
}
|
|
135
307
|
async function diff(argv, flags, deps) {
|
|
136
308
|
const name = argv[0];
|
|
137
309
|
if (!name) throw new CliError("Usage: cos diff <block>");
|
|
@@ -225,9 +397,19 @@ Accepted: ${name} is recorded as merged up to ${target} (${LOCK}). Your files ar
|
|
|
225
397
|
return 0;
|
|
226
398
|
}
|
|
227
399
|
export {
|
|
400
|
+
ACCOUNT_SECTIONS_FILE,
|
|
401
|
+
ACCOUNT_SHELLS,
|
|
402
|
+
accountSectionsSource,
|
|
228
403
|
add,
|
|
229
404
|
blockManifest,
|
|
405
|
+
changedBlocks,
|
|
406
|
+
changedBlocksWords,
|
|
407
|
+
copyBlocks,
|
|
230
408
|
diff,
|
|
231
409
|
installCommand,
|
|
232
|
-
listBlocks
|
|
410
|
+
listBlocks,
|
|
411
|
+
rewriteAccountSections,
|
|
412
|
+
saveLock,
|
|
413
|
+
unwiredWords,
|
|
414
|
+
writeAccountSections
|
|
233
415
|
};
|