turnzero 0.25.5 → 0.26.0-next.1
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/turnzero-cloud.mjs +31 -7
- package/package.json +1 -1
package/dist/turnzero-cloud.mjs
CHANGED
|
@@ -3121,6 +3121,15 @@ var jsonTextOf = (bytes) => {
|
|
|
3121
3121
|
return text.startsWith(BYTE_ORDER_MARK3) ? text.slice(BYTE_ORDER_MARK3.length) : text;
|
|
3122
3122
|
};
|
|
3123
3123
|
var applicationManifestPartialOf = (at) => `${at}.partial`;
|
|
3124
|
+
var MADE_MANIFEST_MEMBERS = Object.freeze({
|
|
3125
|
+
manifest_version: 1,
|
|
3126
|
+
services: [],
|
|
3127
|
+
health: "/health",
|
|
3128
|
+
region: "usa",
|
|
3129
|
+
egress: [],
|
|
3130
|
+
audience: { kind: "public" },
|
|
3131
|
+
packages: []
|
|
3132
|
+
});
|
|
3124
3133
|
var NOT_BOUND = Object.freeze({ kind: "unbound", manifest: null });
|
|
3125
3134
|
var folderBindingOf = (io2, path) => {
|
|
3126
3135
|
let text;
|
|
@@ -5435,6 +5444,7 @@ var jsonEscapeOf = (character) => Array.from({ length: character.length }, (_, i
|
|
|
5435
5444
|
var shownJson = (text) => [...text].map((character) => shownWhole(character) === character ? character : jsonEscapeOf(character)).join("");
|
|
5436
5445
|
var packagesLineOf = (rows) => `${PACKAGES_LINE_HEAD}${shownJson(JSON.stringify(rows))}`;
|
|
5437
5446
|
var PARTIAL_LINK_SENTENCE = writtenLinkSentence(`The file the application manifest is written to first, ${MANIFEST_FILE2}.partial beside it,`);
|
|
5447
|
+
var MANIFEST_LINK_SENTENCE = writtenLinkSentence("The application manifest");
|
|
5438
5448
|
var danglingLinkAt = (io2, folder, name) => io2.stat(join8(folder, name)) === null && (io2.listFolder(folder) ?? []).some((held) => held.toLowerCase() === name.toLowerCase() && io2.stat(join8(folder, held)) === null);
|
|
5439
5449
|
var linkStandsAt = (io2, path) => {
|
|
5440
5450
|
const name = basename2(path);
|
|
@@ -5452,13 +5462,14 @@ var applicationManifestOf = (io2, root, library, folder = applicationFolderOf(io
|
|
|
5452
5462
|
if (folder === null) return { at: null, unwritten: "no_folder" };
|
|
5453
5463
|
const at = join8(folder, MANIFEST_FILE2);
|
|
5454
5464
|
const standing = io2.stat(at);
|
|
5455
|
-
if (standing === null) return { at, unwritten: "not_standing" };
|
|
5456
5465
|
if (!heldInside(io2, root, at)) return { refusal: linkSentence("The application manifest", ROOT_CALLED) };
|
|
5466
|
+
if (standing === null && (linkStandsAt(io2, at) || danglingLinkAt(io2, folder, MANIFEST_FILE2))) return { refusal: MANIFEST_LINK_SENTENCE };
|
|
5457
5467
|
const libraryManifest = join8(library, MANIFEST_FILE2);
|
|
5458
5468
|
if (resolve10(at) === resolve10(libraryManifest) || realPlaceOf(io2, at) === realPlaceOf(io2, libraryManifest)) return { at, unwritten: "library_manifest" };
|
|
5459
|
-
if (standing
|
|
5469
|
+
if (standing?.folder === true) return { at, unwritten: "no_object" };
|
|
5460
5470
|
const partial = applicationManifestPartialOf(at);
|
|
5461
5471
|
if (linkStandsAt(io2, partial) || !heldInside(io2, root, partial)) return { refusal: PARTIAL_LINK_SENTENCE };
|
|
5472
|
+
if (standing === null) return { at, parsed: { ...MADE_MANIFEST_MEMBERS }, made: true };
|
|
5462
5473
|
try {
|
|
5463
5474
|
const parsed = JSON.parse(jsonTextOf(io2.readFile(at)));
|
|
5464
5475
|
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) return { at, parsed };
|
|
@@ -5468,16 +5479,16 @@ var applicationManifestOf = (io2, root, library, folder = applicationFolderOf(io
|
|
|
5468
5479
|
};
|
|
5469
5480
|
var writeApplicationManifest = (io2, manifest, packages) => {
|
|
5470
5481
|
if (!("parsed" in manifest)) return manifest;
|
|
5471
|
-
|
|
5482
|
+
if (!writeManifestMember(io2, manifest, "packages", packages)) return { at: manifest.at, unwritten: "write_failed" };
|
|
5483
|
+
return manifest.made === true ? { written: manifest.at, made: true } : { written: manifest.at };
|
|
5472
5484
|
};
|
|
5473
5485
|
var COPY_ROWS_YOURSELF = "copy these rows into the application manifest's packages member yourself";
|
|
5474
5486
|
var packagesWhereOf = (root, outcome) => {
|
|
5475
5487
|
const shown2 = shownFrom(root);
|
|
5476
|
-
if ("written" in outcome) return `written to ${shown2(outcome.written)}`;
|
|
5488
|
+
if ("written" in outcome) return outcome.made === true ? `made ${shown2(outcome.written)}` : `written to ${shown2(outcome.written)}`;
|
|
5477
5489
|
const at = outcome.at === null ? "" : shown2(outcome.at);
|
|
5478
5490
|
const why = {
|
|
5479
5491
|
no_folder: "no application's folder stands, neither app/package.json nor the project root's package.json",
|
|
5480
|
-
not_standing: `${at} does not stand`,
|
|
5481
5492
|
no_object: `${at} holds no JSON object`,
|
|
5482
5493
|
library_manifest: `${at} is the library folder's own manifest`,
|
|
5483
5494
|
write_failed: `the write of ${at} failed`
|
|
@@ -5491,6 +5502,7 @@ var committedFilesOf = (copied, written) => {
|
|
|
5491
5502
|
};
|
|
5492
5503
|
var COPY_PACKAGES_CLAUSE = "copy the packages line into the application manifest's packages member at each submission; ";
|
|
5493
5504
|
var KEEP_PACKAGES_CLAUSE = "the application manifest was written whole, so read it again before patching it, carry its packages member over in any later rewrite, and call submit_manifest with it before the next deploy; ";
|
|
5505
|
+
var MADE_MANIFEST_CLAUSE = "the application manifest was made with no services and a public audience, so declare the services and the audience the application uses in it before submit_manifest; ";
|
|
5494
5506
|
var installFailedSentence = (folder) => `npm install in ${folder} did not finish: the entry, its row, and the copy are written. Run npm install there again; running this line again takes the entry again whole.`;
|
|
5495
5507
|
var LIBRARY_AFTER_OWN_ERROR = "the entry's folder, its manifest row, or the application's copy may stand in part, and running the line again replaces each whole";
|
|
5496
5508
|
async function readTake(io2, options, userAgent, bearer, planOf, planeChecked = false) {
|
|
@@ -5624,7 +5636,7 @@ async function installTake(io2, root, plan, manifestText, application) {
|
|
|
5624
5636
|
io2.print(`${packagesLineOf(packagesOf(manifestText))} ${packagesWhereOf(root, application)}`);
|
|
5625
5637
|
if (!("written" in application) && application.unwritten === "write_failed") status = COMMAND_STATUS.failed;
|
|
5626
5638
|
io2.print(
|
|
5627
|
-
`next: commit ${committedFilesOf(plan !== null, "written" in application)}; ${"written" in application ? KEEP_PACKAGES_CLAUSE : COPY_PACKAGES_CLAUSE}and, where the project holds the registrar, pin the version in its instance file and run validate with kind library.`
|
|
5639
|
+
`next: commit ${committedFilesOf(plan !== null, "written" in application)}; ${"written" in application ? `${application.made === true ? MADE_MANIFEST_CLAUSE : ""}${KEEP_PACKAGES_CLAUSE}` : COPY_PACKAGES_CLAUSE}and, where the project holds the registrar, pin the version in its instance file and run validate with kind library.`
|
|
5628
5640
|
);
|
|
5629
5641
|
printAfterInterrupt(io2, afterInterrupt);
|
|
5630
5642
|
return status;
|
|
@@ -8717,10 +8729,21 @@ var TAKE_MADE_FILES = Object.freeze({
|
|
|
8717
8729
|
"package.json": "file",
|
|
8718
8730
|
lib: "folder",
|
|
8719
8731
|
"package-lock.json": "file",
|
|
8720
|
-
node_modules: "folder"
|
|
8732
|
+
node_modules: "folder",
|
|
8733
|
+
[MANIFEST_FILE2]: "file"
|
|
8721
8734
|
});
|
|
8722
8735
|
var TAKE_MADE_FILE_LIMIT = 65536;
|
|
8723
8736
|
var LIBRARY_COPIES = "lib";
|
|
8737
|
+
var madeManifestStands = (io2, app) => {
|
|
8738
|
+
const at = join10(app, MANIFEST_FILE2);
|
|
8739
|
+
if ((io2.stat(at)?.size ?? Infinity) > TAKE_MADE_FILE_LIMIT) return false;
|
|
8740
|
+
const found = libraryFolderOf(io2, dirname6(app), SCAFFOLD_FOLDER_WORDS);
|
|
8741
|
+
if ("refusal" in found) return false;
|
|
8742
|
+
const manifest = found.fresh ? { rows: null } : manifestRowsOf(io2, found.folder, SCAFFOLD_FOLDER_WORDS);
|
|
8743
|
+
if ("refusal" in manifest) return false;
|
|
8744
|
+
const made = { ...MADE_MANIFEST_MEMBERS, packages: heldPackagesOf(manifest.rows) };
|
|
8745
|
+
return JSON.stringify(JSON.parse(jsonTextOf(io2.readFile(at)))) === JSON.stringify(made);
|
|
8746
|
+
};
|
|
8724
8747
|
var takeMadeEntriesOf = (io2, app) => {
|
|
8725
8748
|
try {
|
|
8726
8749
|
const names = io2.listFolder(app) ?? [];
|
|
@@ -8749,6 +8772,7 @@ var takeMadeEntriesOf = (io2, app) => {
|
|
|
8749
8772
|
const lib = join10(app, LIBRARY_COPIES);
|
|
8750
8773
|
const copies = io2.listFolder(lib) ?? [];
|
|
8751
8774
|
if (entries.length === 0 || copies.length !== entries.length || !copies.every((copy) => entries.includes(copy))) return null;
|
|
8775
|
+
if (names.includes(MANIFEST_FILE2) && !madeManifestStands(io2, app)) return null;
|
|
8752
8776
|
return entries.every((entry) => io2.stat(join10(lib, entry))?.folder === true) ? entries : null;
|
|
8753
8777
|
} catch {
|
|
8754
8778
|
return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "turnzero",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0-next.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The Turn Zero Cloud command, which an AI coding tool runs on your machine to deploy an application, store a secret, upload a file, download an export, take a library entry, write a local run's settings, start the application locally, and scaffold a new service from a template.",
|
|
6
6
|
"license": "Apache-2.0",
|