artifen 0.1.0 → 0.1.2
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/README.md +2 -0
- package/dist/artifen.js +367 -102
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,6 +29,7 @@ A `<site>` is a site's 8-character ID or any of its addresses, such as `https://
|
|
|
29
29
|
| `sites archive <site>`, `sites unarchive <site>` | Archive a site nobody uses: its address and pages keep working and a live app stops running until it is unarchived. Unarchiving past the plan's limits archives the site used least recently that nobody pinned, or the one used least recently when every one is pinned |
|
|
30
30
|
| `sites pin <site>`, `sites unpin <site>` | Pin a site to the top of your library, which keeps the daily tidy-up from archiving it |
|
|
31
31
|
| `sites publish <site>` | Publish a site's preview to its address, with its database migrations |
|
|
32
|
+
| `sites leave <site>` | Remove your own role on a site, such as a share or the Editor role you keep after transferring it. A site you reach through its workspace stays open to you. Only its Owners can give your role back |
|
|
32
33
|
| `files read <site> <path>` | Read a file, with `--version` for an older one and `--out` to save it exactly |
|
|
33
34
|
| `files write <site> <folder or file>...` | Create or replace whole files, with `--overwrite` for files you have not read |
|
|
34
35
|
| `files edit <site> <path> --old <text> --new <text>` | Replace text that appears exactly once |
|
|
@@ -47,6 +48,7 @@ A `<site>` is a site's 8-character ID or any of its addresses, such as `https://
|
|
|
47
48
|
| `comments list <site>`, `comments reply <site> <comment> <text>` | Read comments on a site, and reply |
|
|
48
49
|
| `keys create <site> <name>`, `keys list <site>`, `keys delete <site> <key-id>` | Make, list, and delete a site's keys, which a script elsewhere sends in the `Artifen-Site-Key` header to reach a site open only to its people, as you. A new key is shown once |
|
|
49
50
|
| `keys temporary <site>` | Print a key from this computer's sign-in that lasts up to an hour, for a script here. The same key is printed again until ten minutes before it expires |
|
|
51
|
+
| `transfers send <site> <email-or-workspace-id>`, `transfers list`, `transfers accept <transfer-id> [workspace-id]`, `transfers cancel <transfer-id>` | Send a site to a person by email or to another workspace, keeping its address, list the transfers waiting, take one into a workspace you own, and cancel or decline one. Only the site's Owner sends one, and it moves at once when you own the destination too |
|
|
50
52
|
| `data-keys create <site> <name> --permissions <list>`, `data-keys list <site>`, `data-keys renew <site> <key-id>`, `data-keys delete <site> <key-id>` | Make, list, renew, and delete a site's data keys, which a script or a device sends as `Authorization: Bearer` on the site's own address to read or change its published data. Only the site's Owner manages them. A new key is shown once |
|
|
51
53
|
| `git credential <site>` | A short-lived credential for `git clone` and `git push`, and a Git credential helper |
|
|
52
54
|
|
package/dist/artifen.js
CHANGED
|
@@ -994,107 +994,107 @@ var SITE_CODE_FILE_MAX_BYTES = 32 * 1024 * 1024;
|
|
|
994
994
|
var STORED_UPLOAD_PART_BYTES = 16 * 1024 * 1024;
|
|
995
995
|
var STORED_UPLOAD_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
996
996
|
var STORED_UPLOAD_IDLE_MS = 60 * 60 * 1e3;
|
|
997
|
-
var UNLIMITED_PENDING = { dailySafeBrowsingChecks: UNLIMITED };
|
|
998
|
-
var PENDING_ALLOWANCES = {
|
|
999
|
-
free: UNLIMITED_PENDING,
|
|
1000
|
-
plus: UNLIMITED_PENDING,
|
|
1001
|
-
pro: UNLIMITED_PENDING,
|
|
1002
|
-
ceiling: UNLIMITED_PENDING
|
|
1003
|
-
};
|
|
1004
997
|
var MICRO_USD_PER_USD = 1e6;
|
|
998
|
+
var USAGE_PRICES_MICRO_USD = {
|
|
999
|
+
/** A run of a site's server code: a request, a WebSocket upgrade, a scheduled run, or a save or removal in the data store. $2.50 a million. */
|
|
1000
|
+
serverRequest: 2.5,
|
|
1001
|
+
/** One millisecond of server CPU time. $0.02 a million. */
|
|
1002
|
+
serverCpuMs: 0.02,
|
|
1003
|
+
/** One email a site sends. $0.0009. */
|
|
1004
|
+
email: 900,
|
|
1005
|
+
/**
|
|
1006
|
+
* One second of a live app build's sandbox, from its start to its removal. Its instance (one vCPU,
|
|
1007
|
+
* 6 GiB of memory, 12 GB of disk) costs $0.0000025 per GiB-second of memory and $0.00000007 per
|
|
1008
|
+
* GB-second of disk while it runs, and $0.00002 per vCPU-second of the CPU it uses, at the
|
|
1009
|
+
* provider's list prices. This takes the CPU as fully used, the most a second can cost: $0.00003584,
|
|
1010
|
+
* about $0.0022 a minute. A page's files build with no sandbox.
|
|
1011
|
+
*/
|
|
1012
|
+
buildSecond: 35.84,
|
|
1013
|
+
/**
|
|
1014
|
+
* The site model's tokens (`SITE_MODEL`, Claude Haiku 5.5), at the provider's list prices. A call
|
|
1015
|
+
* whose prompt is up to 100,000 tokens pays $0.10 a million for what it reads and $0.50 a million
|
|
1016
|
+
* for what it writes. A longer one pays $0.50 and $2.50 for every token. Thinking is off and
|
|
1017
|
+
* nothing is cached, so these are all a call is billed.
|
|
1018
|
+
*/
|
|
1019
|
+
aiTokens: { longPromptTokens: 1e5, short: { input: 0.1, output: 0.5 }, long: { input: 0.5, output: 2.5 } }
|
|
1020
|
+
};
|
|
1021
|
+
var AI_TOKEN_MOST_MICRO_USD = USAGE_PRICES_MICRO_USD.aiTokens.long.output;
|
|
1005
1022
|
var PLAN_ALLOWANCES = {
|
|
1006
1023
|
free: {
|
|
1007
|
-
liveApps:
|
|
1024
|
+
liveApps: 3,
|
|
1008
1025
|
activeSites: 50,
|
|
1009
1026
|
totalSites: 500,
|
|
1010
|
-
storageBytes:
|
|
1027
|
+
storageBytes: 100 * MB,
|
|
1011
1028
|
fileBytes: 25 * MB,
|
|
1012
1029
|
siteDatabaseBytes: 100 * MB,
|
|
1013
1030
|
monthlyUsageBudget: 0.5 * MICRO_USD_PER_USD,
|
|
1014
1031
|
monthlyServerRequests: 1e5,
|
|
1015
1032
|
monthlyAiTokens: UNLIMITED,
|
|
1016
1033
|
monthlyEmails: 100,
|
|
1017
|
-
dailyBuilds:
|
|
1018
|
-
dailyChanges:
|
|
1034
|
+
dailyBuilds: 3,
|
|
1035
|
+
dailyChanges: 15,
|
|
1019
1036
|
customDomains: 0,
|
|
1020
1037
|
workspaceMembers: 5,
|
|
1021
|
-
storedFilesBytes:
|
|
1038
|
+
storedFilesBytes: 1 * GB,
|
|
1022
1039
|
largestStoredFileBytes: 250 * MB,
|
|
1023
|
-
accountDatabaseBytes:
|
|
1040
|
+
accountDatabaseBytes: 100 * MB,
|
|
1024
1041
|
monthlyServerCpuMs: 30 * MINUTE_MS,
|
|
1025
1042
|
sharedWorkspaces: 1,
|
|
1026
|
-
|
|
1043
|
+
dailySafeBrowsingChecks: 10,
|
|
1044
|
+
dailyShareImages: 5
|
|
1027
1045
|
},
|
|
1028
1046
|
plus: {
|
|
1029
1047
|
liveApps: 25,
|
|
1030
1048
|
activeSites: UNLIMITED,
|
|
1031
1049
|
totalSites: 5e3,
|
|
1032
|
-
storageBytes:
|
|
1050
|
+
storageBytes: 500 * MB,
|
|
1033
1051
|
fileBytes: 25 * MB,
|
|
1034
|
-
siteDatabaseBytes:
|
|
1052
|
+
siteDatabaseBytes: 500 * MB,
|
|
1035
1053
|
monthlyUsageBudget: 2 * MICRO_USD_PER_USD,
|
|
1036
1054
|
monthlyServerRequests: 6e5,
|
|
1037
1055
|
monthlyAiTokens: UNLIMITED,
|
|
1038
1056
|
monthlyEmails: 1e3,
|
|
1039
|
-
dailyBuilds:
|
|
1040
|
-
dailyChanges:
|
|
1041
|
-
customDomains:
|
|
1057
|
+
dailyBuilds: 15,
|
|
1058
|
+
dailyChanges: 96,
|
|
1059
|
+
customDomains: 1,
|
|
1042
1060
|
workspaceMembers: 10,
|
|
1043
|
-
storedFilesBytes:
|
|
1061
|
+
storedFilesBytes: 10 * GB,
|
|
1044
1062
|
largestStoredFileBytes: 5 * GB,
|
|
1045
|
-
accountDatabaseBytes:
|
|
1063
|
+
accountDatabaseBytes: 500 * MB,
|
|
1046
1064
|
monthlyServerCpuMs: 5 * HOUR_MS,
|
|
1047
1065
|
sharedWorkspaces: 3,
|
|
1048
|
-
|
|
1066
|
+
dailySafeBrowsingChecks: 20,
|
|
1067
|
+
dailyShareImages: 10
|
|
1049
1068
|
},
|
|
1050
1069
|
pro: {
|
|
1051
|
-
liveApps:
|
|
1070
|
+
liveApps: 75,
|
|
1052
1071
|
activeSites: UNLIMITED,
|
|
1053
1072
|
totalSites: 15e3,
|
|
1054
|
-
storageBytes:
|
|
1073
|
+
storageBytes: 1.5 * GB,
|
|
1055
1074
|
fileBytes: 25 * MB,
|
|
1056
|
-
siteDatabaseBytes:
|
|
1075
|
+
siteDatabaseBytes: 1.5 * GB,
|
|
1057
1076
|
monthlyUsageBudget: 6 * MICRO_USD_PER_USD,
|
|
1058
1077
|
monthlyServerRequests: 18e5,
|
|
1059
1078
|
monthlyAiTokens: UNLIMITED,
|
|
1060
1079
|
monthlyEmails: 3e3,
|
|
1061
|
-
dailyBuilds:
|
|
1062
|
-
dailyChanges:
|
|
1063
|
-
customDomains:
|
|
1080
|
+
dailyBuilds: 45,
|
|
1081
|
+
dailyChanges: 288,
|
|
1082
|
+
customDomains: 3,
|
|
1064
1083
|
workspaceMembers: 20,
|
|
1065
|
-
storedFilesBytes:
|
|
1084
|
+
storedFilesBytes: 30 * GB,
|
|
1066
1085
|
largestStoredFileBytes: 10 * GB,
|
|
1067
|
-
accountDatabaseBytes:
|
|
1086
|
+
accountDatabaseBytes: 1.5 * GB,
|
|
1068
1087
|
monthlyServerCpuMs: 20 * HOUR_MS,
|
|
1069
1088
|
sharedWorkspaces: 10,
|
|
1070
|
-
|
|
1089
|
+
dailySafeBrowsingChecks: 60,
|
|
1090
|
+
dailyShareImages: 25
|
|
1071
1091
|
}
|
|
1072
1092
|
};
|
|
1073
1093
|
var INTERNAL_CEILINGS = {
|
|
1074
|
-
|
|
1094
|
+
...PLAN_ALLOWANCES.pro,
|
|
1075
1095
|
activeSites: 15e3,
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
fileBytes: 25 * MB,
|
|
1079
|
-
siteDatabaseBytes: 3 * GB,
|
|
1080
|
-
monthlyUsageBudget: 6 * MICRO_USD_PER_USD,
|
|
1081
|
-
monthlyServerRequests: 18e5,
|
|
1082
|
-
monthlyAiTokens: 2e7,
|
|
1083
|
-
monthlyEmails: 3e3,
|
|
1084
|
-
dailyBuilds: 150,
|
|
1085
|
-
// Every change counts, a live app's too, so this is twice Pro's live app builds a day, far past the
|
|
1086
|
-
// page changes of a busy day of an agent editing pages. A change
|
|
1087
|
-
// pulls and pushes the site's repository, two billed operations at $0.15 per 1,000, so an account
|
|
1088
|
-
// at this many every day costs $2.70 a month (the cost model test).
|
|
1089
|
-
dailyChanges: 300,
|
|
1090
|
-
customDomains: 35,
|
|
1091
|
-
workspaceMembers: 20,
|
|
1092
|
-
storedFilesBytes: 100 * GB,
|
|
1093
|
-
largestStoredFileBytes: 10 * GB,
|
|
1094
|
-
accountDatabaseBytes: 6 * GB,
|
|
1095
|
-
monthlyServerCpuMs: 20 * HOUR_MS,
|
|
1096
|
-
sharedWorkspaces: 10,
|
|
1097
|
-
...PENDING_ALLOWANCES.ceiling
|
|
1096
|
+
// AI draws on the usage budget, which bounds it. This stops a run of calls whose holds lapse before they settle.
|
|
1097
|
+
monthlyAiTokens: 2e7
|
|
1098
1098
|
};
|
|
1099
1099
|
var LIVE_APPS_WHILE_PAUSED = "Live apps stop running: their visitors see a saved copy of the home page or a short notice.";
|
|
1100
1100
|
var SERVER_PAUSE_EFFECTS = [
|
|
@@ -1179,6 +1179,8 @@ var SITE_CAPABILITIES = [
|
|
|
1179
1179
|
"manage_github",
|
|
1180
1180
|
/** Delete the site for good. */
|
|
1181
1181
|
"purge_site",
|
|
1182
|
+
/** Send the site to another workspace, or to a person to take into one of theirs, and cancel that. */
|
|
1183
|
+
"transfer_site",
|
|
1182
1184
|
/** Make, renew, and delete the site's data keys. */
|
|
1183
1185
|
"manage_data_keys"
|
|
1184
1186
|
];
|
|
@@ -1357,7 +1359,7 @@ var ERROR_COPY = {
|
|
|
1357
1359
|
},
|
|
1358
1360
|
secret_name_invalid: {
|
|
1359
1361
|
message: "That is not a valid secret name.",
|
|
1360
|
-
hint: "Use capital letters, digits, and underscores, starting with a letter, such as
|
|
1362
|
+
hint: "Use capital letters, digits, and underscores, starting with a letter, such as API_KEY. Names starting with ARTIFEN_ are reserved."
|
|
1361
1363
|
},
|
|
1362
1364
|
site_key_invalid: {
|
|
1363
1365
|
message: "This site key does not open this site.",
|
|
@@ -1425,10 +1427,12 @@ var MAX_SQL_LENGTH = 2e4;
|
|
|
1425
1427
|
var MAX_SQL_PARAMS = 100;
|
|
1426
1428
|
var QUERY_DEFAULT_ROWS = 100;
|
|
1427
1429
|
var QUERY_MAX_ROWS = 1e3;
|
|
1430
|
+
var DATA_TOOL_ANSWER_BYTES = 2e4;
|
|
1428
1431
|
var SECRET_NAME_MAX_LENGTH = 64;
|
|
1429
1432
|
var SECRET_VALUE_MAX_BYTES = 5 * KB;
|
|
1430
1433
|
var RESERVED_SECRET_PREFIX = "ARTIFEN_";
|
|
1431
1434
|
var UPLOAD_LINK_TTL_MS = 60 * 60 * 1e3;
|
|
1435
|
+
var LINKS_PER_SITE = 1e3;
|
|
1432
1436
|
var COMMENT_BODY_MAX_LENGTH = 1e4;
|
|
1433
1437
|
var LOG_DEFAULT_LIMIT = 100;
|
|
1434
1438
|
var LOG_MAX_LIMIT = 1e3;
|
|
@@ -1496,6 +1500,13 @@ var KEY_PATTERN2 = new RegExp(`^${CREDENTIAL_PREFIXES.dataKey}_(live|test)_([0-9
|
|
|
1496
1500
|
var encoder3 = new TextEncoder();
|
|
1497
1501
|
var DAY_MS2 = 24 * 60 * 6e4;
|
|
1498
1502
|
|
|
1503
|
+
// ../../packages/domain/src/transfers.ts
|
|
1504
|
+
var SITE_TRANSFER_TTL_DAYS = 30;
|
|
1505
|
+
var SITE_TRANSFER_TTL_MS = SITE_TRANSFER_TTL_DAYS * 24 * 60 * 6e4;
|
|
1506
|
+
var SITE_TRANSFER_KEEPS = "its address, files, versions, data, stored files, secrets, custom domains, and insights";
|
|
1507
|
+
var SITE_TRANSFER_ENDS = "its keys, data keys, waiting invitations, joining codes, upload links, and Git credentials";
|
|
1508
|
+
var SITE_TRANSFER_PEOPLE = "People it is shared with keep it. Anyone else in its current workspace loses it unless they are in the new one too. If it has a GitHub link, the link stays only when the GitHub of whoever takes it into the new workspace reaches the repository";
|
|
1509
|
+
|
|
1499
1510
|
// ../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/classic/external.js
|
|
1500
1511
|
var external_exports = {};
|
|
1501
1512
|
__export(external_exports, {
|
|
@@ -21254,7 +21265,7 @@ var slotSchema = resource(
|
|
|
21254
21265
|
);
|
|
21255
21266
|
var secretNameSchema = external_exports.string().min(1).max(SECRET_NAME_MAX_LENGTH).regex(/^[A-Z][A-Z0-9_]*$/, { message: "Use capital letters, digits, and underscores, starting with a letter." }).refine((name) => !name.startsWith(RESERVED_SECRET_PREFIX), {
|
|
21256
21267
|
message: `Names starting with ${RESERVED_SECRET_PREFIX} are reserved.`
|
|
21257
|
-
}).describe("A secret's name, such as
|
|
21268
|
+
}).describe("A secret's name, such as API_KEY: capital letters, digits, and underscores.");
|
|
21258
21269
|
var accountSchema = resource(
|
|
21259
21270
|
external_exports.object({
|
|
21260
21271
|
name: external_exports.string().nullable(),
|
|
@@ -21282,7 +21293,7 @@ var siteSchema = resource(
|
|
|
21282
21293
|
external_exports.object({
|
|
21283
21294
|
id: siteIdSchema,
|
|
21284
21295
|
title: external_exports.string().max(SITE_TITLE_MAX_LENGTH),
|
|
21285
|
-
name: external_exports.string().max(SITE_NAME_MAX_LENGTH).describe("The readable part of the address
|
|
21296
|
+
name: external_exports.string().max(SITE_NAME_MAX_LENGTH).describe("The readable part of the address. It stays when the title changes."),
|
|
21286
21297
|
description: external_exports.string().nullable().describe("What the site is about, written by its owner or taken from its own page, or null."),
|
|
21287
21298
|
url: external_exports.string().describe("The site's address. It always serves the published version."),
|
|
21288
21299
|
preview_url: external_exports.string().nullable().describe("The preview's address, shareable with invited people, or null while edits go straight to url."),
|
|
@@ -21385,7 +21396,7 @@ var buildErrorSchema = resource(
|
|
|
21385
21396
|
column: external_exports.number().int().nullable(),
|
|
21386
21397
|
message: external_exports.string(),
|
|
21387
21398
|
rule: external_exports.string().nullable().describe(
|
|
21388
|
-
"The rule or error code that fired, when there is one. deploy_try_again: the build could not be finished
|
|
21399
|
+
"The rule or error code that fired, when there is one. deploy_try_again: the build could not be finished because of a passing fault on Artifen's side, and nothing in the files caused it. For a change, Artifen builds it again once by itself when the plan's allowances still admit a build, and when that fails too, a change that edits a file builds the site again. A publish that failed this way is not published again by itself: publish it again. deploy_fault: a fault on Artifen's side that Artifen is told of, and trying again may not clear."
|
|
21389
21400
|
)
|
|
21390
21401
|
}),
|
|
21391
21402
|
"BuildError",
|
|
@@ -21483,6 +21494,24 @@ var dataKeySchema = resource(
|
|
|
21483
21494
|
"DataKey",
|
|
21484
21495
|
"A key a script, a device, or a shortcut uses to reach one site's published data, sent in an Authorization: Bearer header to the site's own address. It belongs to the site, not to a person. The key itself is shown only when it is made."
|
|
21485
21496
|
);
|
|
21497
|
+
var siteTransferSchema = resource(
|
|
21498
|
+
external_exports.object({
|
|
21499
|
+
id: entityIdSchema.describe("The transfer's ID, which accepts or cancels it."),
|
|
21500
|
+
site: external_exports.object({ id: siteIdSchema, title: external_exports.string(), url: external_exports.string().describe("The site's address, which stays the same when it moves.") }),
|
|
21501
|
+
from_workspace: external_exports.object({ id: workspaceIdSchema, name: external_exports.string() }).describe("The workspace the site is in until the transfer is accepted."),
|
|
21502
|
+
to: external_exports.object({
|
|
21503
|
+
email: external_exports.string().nullable().describe("The address it was sent to, whose person accepts it into a workspace they own while signed in with that address, confirmed, or null when it was sent to a workspace."),
|
|
21504
|
+
workspace: external_exports.object({ id: workspaceIdSchema, name: external_exports.string() }).nullable().describe("The workspace it was sent to, whose Owners accept it, or null when it was sent to a person.")
|
|
21505
|
+
}).describe("Who the site was sent to: a person by email or a workspace."),
|
|
21506
|
+
sent_by: external_exports.object({ person_id: external_exports.string(), name: external_exports.string().nullable(), email: external_exports.string().nullable().describe("Their sign-in address, to tell who sent it when they gave no name.") }),
|
|
21507
|
+
direction: external_exports.enum(["incoming", "outgoing"]).describe("incoming: sent to you or to a workspace you own, for you to accept or decline. outgoing: a site in a workspace you own, sent by you or another of its Owners, which any of them can cancel."),
|
|
21508
|
+
email_delivery: external_exports.enum(["sending", "sent", "failed"]).nullable().describe("For a transfer sent to an email address, whether the email telling the person was sent. failed: it could not be sent, so tell them yourself or send the site again. Null when it was sent to a workspace."),
|
|
21509
|
+
created_at: timestampSchema,
|
|
21510
|
+
expires_at: timestampSchema.describe("When the transfer lapses if no one has accepted it. The site stays where it is until then.")
|
|
21511
|
+
}),
|
|
21512
|
+
"SiteTransfer",
|
|
21513
|
+
"A site sent to a person or a workspace, waiting to be accepted. The site stays where it is, at the same address, until then."
|
|
21514
|
+
);
|
|
21486
21515
|
var dateSchema = external_exports.iso.date().describe("A UTC day, as 2026-11-29.");
|
|
21487
21516
|
var viewsSchema = external_exports.number().int().min(0).describe("Page views.");
|
|
21488
21517
|
var siteInsightsSchema = resource(
|
|
@@ -21543,7 +21572,7 @@ var commentSchema = resource(
|
|
|
21543
21572
|
body: external_exports.string().max(COMMENT_BODY_MAX_LENGTH),
|
|
21544
21573
|
author: authorSchema,
|
|
21545
21574
|
source: commentSourceSchema,
|
|
21546
|
-
page: external_exports.string().describe("The page of the site the comment is on, such as /
|
|
21575
|
+
page: external_exports.string().describe("The page of the site the comment is on, such as /about."),
|
|
21547
21576
|
status: external_exports.enum(["open", "resolved"]),
|
|
21548
21577
|
replies: external_exports.array(commentReplySchema),
|
|
21549
21578
|
created_at: timestampSchema
|
|
@@ -21562,7 +21591,10 @@ var dataQueryResultSchema = resource(
|
|
|
21562
21591
|
columns: external_exports.array(external_exports.string()),
|
|
21563
21592
|
rows: external_exports.array(external_exports.array(queryResultValueSchema)).describe("One array per row, in the order of columns."),
|
|
21564
21593
|
row_count: external_exports.number().int(),
|
|
21565
|
-
truncated: external_exports.boolean().describe("True when the query matched more rows than were returned."),
|
|
21594
|
+
truncated: external_exports.boolean().describe("True when the query matched more rows than were returned, past max_rows or cut_for_size."),
|
|
21595
|
+
cut_for_size: external_exports.boolean().describe(
|
|
21596
|
+
`True when rows were left out to keep the answer within ${DATA_TOOL_ANSWER_BYTES / 1e3} KB. To read on, run it again with the same ORDER BY, ending in a unique column, as LIMIT n OFFSET m with m moved on by row_count, and when the query had no such order, start again from its first page with one. When row_count is 0 too, the next row alone is larger than that: select fewer or shorter columns, such as a substr of a long one.`
|
|
21597
|
+
),
|
|
21566
21598
|
duration_ms: external_exports.number().int()
|
|
21567
21599
|
}),
|
|
21568
21600
|
"DataQueryResult",
|
|
@@ -21573,7 +21605,8 @@ var siteRowsPageSchema = resource(
|
|
|
21573
21605
|
slot: slotSchema,
|
|
21574
21606
|
columns: external_exports.array(external_exports.string()),
|
|
21575
21607
|
rows: external_exports.array(external_exports.record(external_exports.string(), external_exports.union([queryResultValueSchema, external_exports.object({ integer: external_exports.string() }).describe("An integer larger than 2^53, by its exact digits.")]))).describe("One object per row, keyed by column. An integer larger than 2^53 comes as { integer: digits }, which a condition or a write takes back."),
|
|
21576
|
-
next_cursor: external_exports.string().nullable().describe("Pass as cursor to read the next page, or null on the last page.")
|
|
21608
|
+
next_cursor: external_exports.string().nullable().describe("Pass as cursor to read the next page, or null on the last page."),
|
|
21609
|
+
cut_for_size: external_exports.boolean().describe(`True when the page ended before limit to stay within ${DATA_TOOL_ANSWER_BYTES / 1e3} KB. next_cursor goes on from its last row.`)
|
|
21577
21610
|
}),
|
|
21578
21611
|
"SiteRowsPage",
|
|
21579
21612
|
"A page of rows from one table of a live app's database."
|
|
@@ -21590,7 +21623,8 @@ var siteEntriesPageSchema = resource(
|
|
|
21590
21623
|
slot: slotSchema,
|
|
21591
21624
|
collection: external_exports.string(),
|
|
21592
21625
|
entries: external_exports.array(siteEntrySchema),
|
|
21593
|
-
next_cursor: external_exports.string().nullable().describe("Pass as cursor to read the next page, or null on the last page.")
|
|
21626
|
+
next_cursor: external_exports.string().nullable().describe("Pass as cursor to read the next page, or null on the last page."),
|
|
21627
|
+
cut_for_size: external_exports.boolean().describe(`True when the page ended before limit to stay within ${DATA_TOOL_ANSWER_BYTES / 1e3} KB. next_cursor goes on from its last entry.`)
|
|
21594
21628
|
}),
|
|
21595
21629
|
"SiteEntriesPage",
|
|
21596
21630
|
"A page of entries from one collection of a site's data store."
|
|
@@ -21739,7 +21773,7 @@ var DATA_VALUE_MAX_BYTES = 16 * 1024;
|
|
|
21739
21773
|
var DATA_LIST_DEFAULT = 50;
|
|
21740
21774
|
var DATA_LIST_MAX = 100;
|
|
21741
21775
|
var DATA_PAGE_MAX_BYTES = 4e6 - 256 * 1024;
|
|
21742
|
-
var DATA_STORE_MAX_BYTES = 100 *
|
|
21776
|
+
var DATA_STORE_MAX_BYTES = 100 * MB;
|
|
21743
21777
|
var DATA_PUBLIC_MAX_BYTES = 10 * 1024 * 1024;
|
|
21744
21778
|
var DATA_MEASURE_STEP_BYTES = 1024 * 1024;
|
|
21745
21779
|
var DATA_RULES_MAX_BYTES = 64 * 1024;
|
|
@@ -21897,7 +21931,7 @@ function filesForStart(input2, context) {
|
|
|
21897
21931
|
}
|
|
21898
21932
|
var createSiteInput = external_exports.object({
|
|
21899
21933
|
workspace_id: workspaceIdSchema.describe("The workspace that will own the site."),
|
|
21900
|
-
title: external_exports.string().trim().min(1).max(SITE_TITLE_MAX_LENGTH).describe("The site's title.
|
|
21934
|
+
title: external_exports.string().trim().min(1).max(SITE_TITLE_MAX_LENGTH).describe("The site's title. The site's address is made from it, and stays when the title changes later."),
|
|
21901
21935
|
start_from: startFromSchema,
|
|
21902
21936
|
files: external_exports.array(newFileSchema).min(1).max(MAX_FILES_PER_CREATE).optional().describe("The site's first files. Required when start_from is files. With template, they replace or add to the template's files."),
|
|
21903
21937
|
attachments
|
|
@@ -21984,7 +22018,7 @@ var readSiteRowsShape = external_exports.object({
|
|
|
21984
22018
|
),
|
|
21985
22019
|
order_by: rowReadSchema.shape.order_by.describe("The column the rows come in order of. Without one, the order they were added in."),
|
|
21986
22020
|
direction: rowReadSchema.shape.direction.describe("asc (default) or desc."),
|
|
21987
|
-
limit: rowReadSchema.shape.limit.describe(`Rows on one page, ${ROWS_PAGE_DEFAULT} by default, at most ${ROWS_PAGE_MAX}.`),
|
|
22021
|
+
limit: rowReadSchema.shape.limit.describe(`Rows on one page, ${ROWS_PAGE_DEFAULT} by default, at most ${ROWS_PAGE_MAX}. A page of large rows ends sooner, with next_cursor to continue.`),
|
|
21988
22022
|
cursor: rowReadSchema.shape.cursor.describe("The next_cursor of the page before, sent with the same table, conditions, and order.")
|
|
21989
22023
|
}).strict();
|
|
21990
22024
|
var withinBoundValues = (read) => boundValuesOf(read.where) <= ROW_BOUND_VALUES_MAX;
|
|
@@ -22059,13 +22093,24 @@ var deleteSiteDataKeyInput = external_exports.object({ site_id: siteIdSchema, ke
|
|
|
22059
22093
|
var createSiteUploadInput = external_exports.object({
|
|
22060
22094
|
site_id: siteIdSchema,
|
|
22061
22095
|
path: sitePathSchema.optional().describe("Where a source file will land in the site's code and pages. A file already there is replaced. Give this or stored_key."),
|
|
22062
|
-
stored_key: external_exports.string().min(1).max(512).optional().describe("Instead of path: the key of a live app's stored file, such as
|
|
22096
|
+
stored_key: external_exports.string().min(1).max(512).optional().describe("Instead of path: the key of a live app's stored file, such as media/a.mp4, up to the plan's max upload size and served at /__artifen/files/<key>, never a page, script, SVG image, or XML file. A file already there is replaced."),
|
|
22063
22097
|
slot: external_exports.enum(SITE_SLOTS).optional().describe("With stored_key: the published site's stored files (live, the default) or its preview's.")
|
|
22064
22098
|
}).strict();
|
|
22099
|
+
var transferSiteInput = external_exports.object({
|
|
22100
|
+
site_id: siteIdSchema,
|
|
22101
|
+
to_email: external_exports.string().min(3).max(254).optional().describe("Send it to a person, by their email address. They accept it into a workspace they own, signed in with that address. Give this or to_workspace_id."),
|
|
22102
|
+
to_workspace_id: workspaceIdSchema.optional().describe("Instead of to_email: send it to a workspace. When you are an Owner of that workspace too, the site moves at once. Otherwise one of its Owners accepts it.")
|
|
22103
|
+
}).strict();
|
|
22104
|
+
var listSiteTransfersInput = external_exports.object({ site_id: siteIdSchema.optional().describe("Only this site's transfer.") }).strict();
|
|
22105
|
+
var acceptSiteTransferInput = external_exports.object({
|
|
22106
|
+
transfer_id: entityIdSchema.describe("The transfer's ID, as the site transfers list shows it."),
|
|
22107
|
+
workspace_id: workspaceIdSchema.optional().describe("The workspace to take the site into, one you own. Needed for a site sent to you by email. A site sent to a workspace goes into that workspace.")
|
|
22108
|
+
}).strict();
|
|
22109
|
+
var cancelSiteTransferInput = external_exports.object({ transfer_id: entityIdSchema.describe("The transfer's ID, as the site transfers list shows it.") }).strict();
|
|
22065
22110
|
var listSiteCommentsInput = external_exports.object({
|
|
22066
22111
|
site_id: siteIdSchema,
|
|
22067
22112
|
status: external_exports.enum(["open", "resolved", "all"]).optional().describe("open (default), resolved, or all."),
|
|
22068
|
-
page: external_exports.string().max(1e3).optional().describe("Only comments on this page of the site, such as /
|
|
22113
|
+
page: external_exports.string().max(1e3).optional().describe("Only comments on this page of the site, such as /about."),
|
|
22069
22114
|
cursor: cursorSchema.optional(),
|
|
22070
22115
|
limit: listLimitSchema().optional()
|
|
22071
22116
|
}).strict();
|
|
@@ -22141,6 +22186,12 @@ var listSiteKeysOutput = external_exports.object({
|
|
|
22141
22186
|
site_keys: external_exports.array(siteKeySchema).describe("Your keys for the site, and everyone's when you can manage who the site is shared with. Newest first.")
|
|
22142
22187
|
});
|
|
22143
22188
|
var deleteSiteKeyOutput = external_exports.object({ deleted: external_exports.boolean().describe("False when no key you can delete had this ID, so nothing changed.") });
|
|
22189
|
+
var createSiteGitCredentialOutput = external_exports.object({
|
|
22190
|
+
clone_url: external_exports.string().describe("The site's Git address."),
|
|
22191
|
+
username: external_exports.string().describe("The user name to pair with the password for Basic sign-in. Not needed when the password is sent in an Authorization: Bearer header."),
|
|
22192
|
+
password: external_exports.string().describe("The token to send in an Authorization: Bearer header. It is shown only now."),
|
|
22193
|
+
expires_at: timestampSchema
|
|
22194
|
+
});
|
|
22144
22195
|
var createTemporarySiteKeyOutput = external_exports.object({
|
|
22145
22196
|
key: external_exports.string(),
|
|
22146
22197
|
header: keyHeaderSchema,
|
|
@@ -22157,6 +22208,17 @@ var renewSiteDataKeyOutput = external_exports.object({
|
|
|
22157
22208
|
key: dataKeyValueSchema,
|
|
22158
22209
|
replaced: dataKeySchema.describe("The renewed key, which keeps working until its expires_at.")
|
|
22159
22210
|
});
|
|
22211
|
+
var movedSchema = external_exports.object({ site_id: siteIdSchema, workspace: external_exports.object({ id: workspaceIdSchema, name: external_exports.string() }) }).describe("The site, now in this workspace at the same address.");
|
|
22212
|
+
var transferSiteOutput = external_exports.object({
|
|
22213
|
+
transfer: siteTransferSchema.nullable().describe("The transfer waiting to be accepted, or null when the site moved at once."),
|
|
22214
|
+
moved: movedSchema.nullable().describe("Where the site moved, when it moved at once because you are an Owner of both workspaces, otherwise null.")
|
|
22215
|
+
});
|
|
22216
|
+
var listSiteTransfersOutput = external_exports.object({
|
|
22217
|
+
transfers: external_exports.array(siteTransferSchema).describe("Transfers waiting to be accepted: those sent to you or to a workspace you own, and those of sites you own. Newest first.")
|
|
22218
|
+
});
|
|
22219
|
+
var acceptSiteTransferOutput = external_exports.object({ moved: movedSchema });
|
|
22220
|
+
var cancelSiteTransferOutput = external_exports.object({ cancelled: external_exports.boolean().describe("False when the transfer was already accepted, cancelled, or lapsed, so nothing changed.") });
|
|
22221
|
+
var leaveSiteOutput = external_exports.object({ left: external_exports.boolean().describe("False when the site was not shared with you, such as after leaving it already, so nothing changed.") });
|
|
22160
22222
|
var deleteSiteDataKeyOutput = external_exports.object({ deleted: external_exports.boolean().describe("False when the site had no data key with this ID, so nothing changed.") });
|
|
22161
22223
|
var deleteSiteSecretOutput = external_exports.object({
|
|
22162
22224
|
site_id: siteIdSchema,
|
|
@@ -22202,7 +22264,7 @@ var AGENT_TOOLS = [
|
|
|
22202
22264
|
{
|
|
22203
22265
|
name: "create_site",
|
|
22204
22266
|
title: "Create site",
|
|
22205
|
-
description: "How to make something the person can share or keep, such as a page, slideshow, game, or app: create a new site in a workspace, build it, and return its address and the build's result. start_from is template (Artifen's React Router app, with any files you give on top) or files (exactly the files you give). Plain HTML, CSS, and JavaScript are served as they are, and files that form an app are built with type checks and lint, whose errors come back in the result. A site opens only for its workspace's members and the people invited to it until its owner shares it more widely in the Artifen app. Not idempotent: a retry creates another site.",
|
|
22267
|
+
description: "How to make something the person can share or keep, such as a page, slideshow, game, or app: create a new site in a workspace, build it, and return its address and the build's result, or its status while it still runs. start_from is template (Artifen's React Router app, with any files you give on top) or files (exactly the files you give). Plain HTML, CSS, and JavaScript are served as they are, and files that form an app are built with type checks and lint, whose errors come back in the result. A site opens only for its workspace's members and the people invited to it until its owner shares it more widely in the Artifen app. Not idempotent: a retry creates another site.",
|
|
22206
22268
|
input: createSiteInput,
|
|
22207
22269
|
output: createSiteOutput,
|
|
22208
22270
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
|
|
@@ -22235,7 +22297,7 @@ var AGENT_TOOLS = [
|
|
|
22235
22297
|
{
|
|
22236
22298
|
name: "edit_site_file",
|
|
22237
22299
|
title: "Edit site file",
|
|
22238
|
-
description: "Edit one text file of a site by replacing old_string, which must appear exactly once in its current content, with new_string, then build. Makes a new version, and returns it with the build's result. A missing or repeated match changes nothing, and a retry after success finds no match.",
|
|
22300
|
+
description: "Edit one text file of a site by replacing old_string, which must appear exactly once in its current content, with new_string, then build. Makes a new version, and returns it with the build's result, or its status while it still runs. A missing or repeated match changes nothing, and a retry after success finds no match.",
|
|
22239
22301
|
input: editSiteFileInput,
|
|
22240
22302
|
output: changeOutput,
|
|
22241
22303
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false }
|
|
@@ -22243,7 +22305,7 @@ var AGENT_TOOLS = [
|
|
|
22243
22305
|
{
|
|
22244
22306
|
name: "apply_site_patch",
|
|
22245
22307
|
title: "Apply site patch",
|
|
22246
|
-
description: "Apply a multi-file patch to a site, adding new files and changing existing ones together, then build. All of it applies or none of it does. Makes one new version, and returns it with the build's result. A patch that deletes files is refused, and a retry after success no longer applies. With add_starting_project, it turns a site of plain files into an app at the same address, its files moved under public/.",
|
|
22308
|
+
description: "Apply a multi-file patch to a site, adding new files and changing existing ones together, then build. All of it applies or none of it does. Makes one new version, and returns it with the build's result, or its status while it still runs. A patch that deletes files is refused, and a retry after success no longer applies. With add_starting_project, it turns a site of plain files into an app at the same address, its files moved under public/.",
|
|
22247
22309
|
input: applySitePatchInput,
|
|
22248
22310
|
output: changeOutput,
|
|
22249
22311
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false }
|
|
@@ -22251,7 +22313,7 @@ var AGENT_TOOLS = [
|
|
|
22251
22313
|
{
|
|
22252
22314
|
name: "write_site_file",
|
|
22253
22315
|
title: "Write site file",
|
|
22254
|
-
description: "Write one whole file to a site, creating it or replacing it, then build. Replacing a file needs a full read of it first, and a file that changed since that read is refused rather than overwritten. A read in another conversation through the same app can count as yours, so read the file again just before replacing it. Makes a new version, and returns it with the build's result. Send text as content, and an image or other binary file as a public https source_url or a host attachment. A retry with the same content changes nothing and makes no new version.",
|
|
22316
|
+
description: "Write one whole file to a site, creating it or replacing it, then build. Replacing a file needs a full read of it first, and a file that changed since that read is refused rather than overwritten. A read in another conversation through the same app can count as yours, so read the file again just before replacing it. Makes a new version, and returns it with the build's result, or its status while it still runs. Send text as content, and an image or other binary file as a public https source_url or a host attachment. A retry with the same content changes nothing and makes no new version.",
|
|
22255
22317
|
input: writeSiteFileInput,
|
|
22256
22318
|
output: changeOutput,
|
|
22257
22319
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
@@ -22316,7 +22378,7 @@ var AGENT_TOOLS = [
|
|
|
22316
22378
|
{
|
|
22317
22379
|
name: "query_site_data",
|
|
22318
22380
|
title: "Query site data",
|
|
22319
|
-
description: "Run one read-only SQL query against a site's database, the published site's or its preview's, and return the rows. Statements that change data or schema are refused. A page's database is what its pages saved, one table named entries with the columns collection, owner (the person, in a collection kept per person, and empty otherwise), id, value (JSON text), updated_at, and created_by (whoever added the entry while signed in, or null).",
|
|
22381
|
+
description: "Run one read-only SQL query against a site's database, the published site's or its preview's, and return the rows, as many as fit one answer. Statements that change data or schema are refused. A page's database is what its pages saved, one table named entries with the columns collection, owner (the person, in a collection kept per person, and empty otherwise), id, value (JSON text), updated_at, and created_by (whoever added the entry while signed in, or null).",
|
|
22320
22382
|
input: querySiteDataInput,
|
|
22321
22383
|
output: dataQueryOutput,
|
|
22322
22384
|
annotations: READ
|
|
@@ -22340,7 +22402,7 @@ var AGENT_TOOLS = [
|
|
|
22340
22402
|
{
|
|
22341
22403
|
name: "read_site_entries",
|
|
22342
22404
|
title: "Read site entries",
|
|
22343
|
-
description: "Read entries from one collection of a site's data store, the published site's or its preview's: the saved data its pages keep under the collection rules in artifen.data.json, read as you, with your role on the site. The entries that pass every filter, in entry ID order, up to limit at a time, with next_cursor to continue. In a collection kept per person, an Editor or Owner reads every person's entries, ordered by person and then entry ID and each naming its person, or one person's when person is set, and anyone else reads their own. Changes nothing.",
|
|
22405
|
+
description: "Read entries from one collection of a site's data store, the published site's or its preview's: the saved data its pages keep under the collection rules in artifen.data.json, read as you, with your role on the site. The entries that pass every filter, in entry ID order, up to limit at a time or fewer when they are large, with next_cursor to continue. In a collection kept per person, an Editor or Owner reads every person's entries, ordered by person and then entry ID and each naming its person, or one person's when person is set, and anyone else reads their own. Changes nothing.",
|
|
22344
22406
|
input: readSiteEntriesInput,
|
|
22345
22407
|
output: siteEntriesPageOutput,
|
|
22346
22408
|
annotations: READ
|
|
@@ -22393,6 +22455,14 @@ var AGENT_TOOLS = [
|
|
|
22393
22455
|
output: deleteSiteKeyOutput,
|
|
22394
22456
|
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false }
|
|
22395
22457
|
},
|
|
22458
|
+
{
|
|
22459
|
+
name: "create_site_git_credential",
|
|
22460
|
+
title: "Create site Git credential",
|
|
22461
|
+
description: "Make a credential, good for one hour, for git clone, pull, and push on one site's repository from a shell. It comes back with the site's Git address and is returned only now. Making one needs the access to the site's source an Editor or Owner has. A push that moves main makes a new version and builds it, and Git prints whether the build started, or why the push was refused, as for an archived site. When the build could not start, the next push that moves main records it and builds the newest version. A site holds a limited number working at once. Each request is checked against your access at that moment. Each call makes another credential.",
|
|
22462
|
+
input: siteOnlyInput,
|
|
22463
|
+
output: createSiteGitCredentialOutput,
|
|
22464
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false }
|
|
22465
|
+
},
|
|
22396
22466
|
{
|
|
22397
22467
|
name: "create_temporary_site_key",
|
|
22398
22468
|
title: "Create temporary site key",
|
|
@@ -22433,10 +22503,50 @@ var AGENT_TOOLS = [
|
|
|
22433
22503
|
output: deleteSiteDataKeyOutput,
|
|
22434
22504
|
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false }
|
|
22435
22505
|
},
|
|
22506
|
+
{
|
|
22507
|
+
name: "transfer_site",
|
|
22508
|
+
title: "Transfer site",
|
|
22509
|
+
description: `Send a site to another workspace, or to a person by email to take into a workspace they own, with ${SITE_TRANSFER_KEEPS}. When you are an Owner of the destination workspace too, it moves at once. Otherwise it waits up to ${SITE_TRANSFER_TTL_DAYS} days for the recipient to accept, staying where it is until then. When it moves, ${SITE_TRANSFER_ENDS} end. ${SITE_TRANSFER_PEOPLE}. You stay on it as an Editor unless you own the destination, and its payments go to the destination workspace's own payments account. Only the site's Owner sends one, a transfer is dropped if they stop being an Owner of it, and one person sends at most 20 by email a day. Sending again replaces the waiting transfer.`,
|
|
22510
|
+
input: transferSiteInput,
|
|
22511
|
+
output: transferSiteOutput,
|
|
22512
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false }
|
|
22513
|
+
},
|
|
22514
|
+
{
|
|
22515
|
+
name: "list_site_transfers",
|
|
22516
|
+
title: "List site transfers",
|
|
22517
|
+
description: "List the transfers waiting to be accepted: sites sent to your confirmed email address or to a workspace you own, and transfers of sites in a workspace you own.",
|
|
22518
|
+
input: listSiteTransfersInput,
|
|
22519
|
+
output: listSiteTransfersOutput,
|
|
22520
|
+
annotations: READ
|
|
22521
|
+
},
|
|
22522
|
+
{
|
|
22523
|
+
name: "accept_site_transfer",
|
|
22524
|
+
title: "Accept site transfer",
|
|
22525
|
+
description: `Take a site sent to your confirmed email address into a workspace you own, or one sent to a workspace you own into it. The destination's plan must have room for it, and it is refused with try_again while a change, a build, or an upload to the site is still under way. It keeps ${SITE_TRANSFER_KEEPS}, and ${SITE_TRANSFER_ENDS} end. Accepting again after it moved is refused as not found.`,
|
|
22526
|
+
input: acceptSiteTransferInput,
|
|
22527
|
+
output: acceptSiteTransferOutput,
|
|
22528
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false }
|
|
22529
|
+
},
|
|
22530
|
+
{
|
|
22531
|
+
name: "cancel_site_transfer",
|
|
22532
|
+
title: "Cancel site transfer",
|
|
22533
|
+
description: "Cancel a transfer of a site in a workspace you own, or decline one sent to your confirmed email address or to a workspace you own. The site stays where it is. Cancelling again changes nothing.",
|
|
22534
|
+
input: cancelSiteTransferInput,
|
|
22535
|
+
output: cancelSiteTransferOutput,
|
|
22536
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false }
|
|
22537
|
+
},
|
|
22538
|
+
{
|
|
22539
|
+
name: "leave_site",
|
|
22540
|
+
title: "Leave site",
|
|
22541
|
+
description: "Remove yourself from a site shared with you. Your role on it ends, and only its Owners can give it back. A site you reach through its workspace stays open to you: leaving it drops only a role of its own that raised you above the workspace's, such as the Editor role a transfer left you, and is refused otherwise. Leaving again changes nothing.",
|
|
22542
|
+
input: siteOnlyInput,
|
|
22543
|
+
output: leaveSiteOutput,
|
|
22544
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false }
|
|
22545
|
+
},
|
|
22436
22546
|
{
|
|
22437
22547
|
name: "create_site_upload",
|
|
22438
22548
|
title: "Create site upload link",
|
|
22439
|
-
description: `Create a single-use link that puts one file into a site, for a person to open in a browser and choose a file, or for a shell to send. With path, it takes a source file, one of the site's own pages, scripts, or assets, which lands as a new version replacing any file at that path, and the site builds. With stored_key, it takes a stored file of a live app, a large file such as video that the app's code lists and removes, served at /__artifen/files/<key>, and never a page, script, SVG image, or XML file, up to the plan's max upload size, sent in parts, replacing any stored file at that key, with no new version. It needs no sign-in, works once, and expires after ${UPLOAD_LINK_MINUTES} minutes for a source file or a day for a stored one. Each call makes another link.`,
|
|
22549
|
+
description: `Create a single-use link that puts one file into a site, for a person to open in a browser and choose a file, or for a shell to send. With path, it takes a source file, one of the site's own pages, scripts, or assets, which lands as a new version replacing any file at that path, and the site builds. A shell sends it with curl --fail-with-body -sS -X PUT --data-binary "@<file>" "<url>" and gets back { change }, the change with its build, as any change to a file answers. With stored_key, it takes a stored file of a live app, a large file such as video that the app's code lists and removes, served at /__artifen/files/<key>, and never a page, script, SVG image, or XML file, up to the plan's max upload size, sent in parts, replacing any stored file at that key, with no new version. It needs no sign-in, works once, and expires after ${UPLOAD_LINK_MINUTES} minutes for a source file or a day for a stored one. Each call makes another link, and a site holds at most ${LINKS_PER_SITE.toLocaleString("en-US")} unexpired links of each kind, used or not.`,
|
|
22440
22550
|
input: createSiteUploadInput,
|
|
22441
22551
|
output: createSiteUploadOutput,
|
|
22442
22552
|
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false }
|
|
@@ -22524,7 +22634,7 @@ var ROUTES = [
|
|
|
22524
22634
|
authenticated: true,
|
|
22525
22635
|
body: external_exports.object({
|
|
22526
22636
|
workspace_id: workspaceIdSchema.describe("The workspace that will own the site."),
|
|
22527
|
-
title: external_exports.string().trim().min(1).max(SITE_TITLE_MAX_LENGTH).describe("The site's title.
|
|
22637
|
+
title: external_exports.string().trim().min(1).max(SITE_TITLE_MAX_LENGTH).describe("The site's title. The site's address is made from it, and stays when the title changes later."),
|
|
22528
22638
|
start_from: startFromSchema,
|
|
22529
22639
|
files: external_exports.array(apiBatchFile).min(1).max(MAX_FILES_PER_CREATE).optional().describe("The site's first files. Required when start_from is files. With template, they replace or add to the template's files.")
|
|
22530
22640
|
}).strict().superRefine(filesForStart),
|
|
@@ -22932,12 +23042,74 @@ var ROUTES = [
|
|
|
22932
23042
|
response: { status: 200, description: "Whether a key was deleted.", schema: deleteSiteDataKeyOutput },
|
|
22933
23043
|
errors: [...SITE_ERRORS]
|
|
22934
23044
|
},
|
|
23045
|
+
{
|
|
23046
|
+
operationId: "transferSite",
|
|
23047
|
+
method: "post",
|
|
23048
|
+
path: "/v1/sites/{site_id}/transfers",
|
|
23049
|
+
summary: "Transfer a site",
|
|
23050
|
+
description: `Send the site to another workspace, or to a person by email to take into a workspace they own, with ${SITE_TRANSFER_KEEPS}. When you are an Owner of the destination too, it moves at once, and otherwise it waits for the recipient to accept. When it moves, ${SITE_TRANSFER_ENDS} end. ${SITE_TRANSFER_PEOPLE}. You stay on it as an Editor unless you own the destination. Only the site's Owner sends one.`,
|
|
23051
|
+
tool: "transfer_site",
|
|
23052
|
+
authenticated: true,
|
|
23053
|
+
params: siteParams,
|
|
23054
|
+
body: transferSiteInput.omit({ site_id: true }),
|
|
23055
|
+
response: { status: 201, description: "The waiting transfer, or where the site moved.", schema: transferSiteOutput },
|
|
23056
|
+
errors: [...SITE_ERRORS, "quota_exceeded", "limit_reached", "rate_limited", "try_again"]
|
|
23057
|
+
},
|
|
23058
|
+
{
|
|
23059
|
+
operationId: "listSiteTransfers",
|
|
23060
|
+
method: "get",
|
|
23061
|
+
path: "/v1/transfers",
|
|
23062
|
+
summary: "List site transfers",
|
|
23063
|
+
description: "Transfers waiting to be accepted: sites sent to your confirmed email address or to a workspace you own, and transfers of sites in a workspace you own.",
|
|
23064
|
+
tool: "list_site_transfers",
|
|
23065
|
+
authenticated: true,
|
|
23066
|
+
query: listSiteTransfersInput,
|
|
23067
|
+
response: { status: 200, description: "The transfers, newest first.", schema: listSiteTransfersOutput },
|
|
23068
|
+
errors: ["not_found"]
|
|
23069
|
+
},
|
|
23070
|
+
{
|
|
23071
|
+
operationId: "acceptSiteTransfer",
|
|
23072
|
+
method: "post",
|
|
23073
|
+
path: "/v1/transfers/{transfer_id}/accept",
|
|
23074
|
+
summary: "Accept a site transfer",
|
|
23075
|
+
description: "Take a site sent to your confirmed email address, or to a workspace you own, into a workspace you own. Its plan must have room for the site.",
|
|
23076
|
+
tool: "accept_site_transfer",
|
|
23077
|
+
authenticated: true,
|
|
23078
|
+
params: acceptSiteTransferInput.pick({ transfer_id: true }),
|
|
23079
|
+
body: acceptSiteTransferInput.omit({ transfer_id: true }),
|
|
23080
|
+
response: { status: 200, description: "Where the site moved.", schema: acceptSiteTransferOutput },
|
|
23081
|
+
errors: ["not_found", "forbidden", "validation_failed", "quota_exceeded", "limit_reached", "seat_suspended", "try_again"]
|
|
23082
|
+
},
|
|
23083
|
+
{
|
|
23084
|
+
operationId: "cancelSiteTransfer",
|
|
23085
|
+
method: "delete",
|
|
23086
|
+
path: "/v1/transfers/{transfer_id}",
|
|
23087
|
+
summary: "Cancel a site transfer",
|
|
23088
|
+
description: "Cancel a transfer of a site in a workspace you own, or decline one sent to your confirmed email address or to a workspace you own. The site stays where it is.",
|
|
23089
|
+
tool: "cancel_site_transfer",
|
|
23090
|
+
authenticated: true,
|
|
23091
|
+
params: cancelSiteTransferInput,
|
|
23092
|
+
response: { status: 200, description: "Whether a waiting transfer was cancelled.", schema: cancelSiteTransferOutput },
|
|
23093
|
+
errors: ["not_found"]
|
|
23094
|
+
},
|
|
23095
|
+
{
|
|
23096
|
+
operationId: "leaveSite",
|
|
23097
|
+
method: "post",
|
|
23098
|
+
path: "/v1/sites/{site_id}/leave",
|
|
23099
|
+
summary: "Leave a site",
|
|
23100
|
+
description: "Remove yourself from a site shared with you. Your role on it ends, and only its Owners can give it back. A site you reach through its workspace stays open to you: leaving it drops only a role of its own that raised you above the workspace's, and is refused otherwise.",
|
|
23101
|
+
tool: "leave_site",
|
|
23102
|
+
authenticated: true,
|
|
23103
|
+
params: siteParams,
|
|
23104
|
+
response: { status: 200, description: "Whether you left the site.", schema: leaveSiteOutput },
|
|
23105
|
+
errors: ["validation_failed"]
|
|
23106
|
+
},
|
|
22935
23107
|
{
|
|
22936
23108
|
operationId: "createSiteUpload",
|
|
22937
23109
|
method: "post",
|
|
22938
23110
|
path: "/v1/sites/{site_id}/uploads",
|
|
22939
23111
|
summary: "Create an upload link",
|
|
22940
|
-
description:
|
|
23112
|
+
description: `A single-use link that puts one file into the site: a source file at a path, which a PUT of its bytes lands as a new version, or a live app's stored file at a key, up to the plan's max upload size, sent in parts, never a page, script, SVG image, or XML file. Open it in a browser to choose a file. A site holds at most ${LINKS_PER_SITE.toLocaleString("en-US")} unexpired links of each kind, used or not.`,
|
|
22941
23113
|
tool: "create_site_upload",
|
|
22942
23114
|
authenticated: true,
|
|
22943
23115
|
params: siteParams,
|
|
@@ -22976,19 +23148,11 @@ var ROUTES = [
|
|
|
22976
23148
|
method: "post",
|
|
22977
23149
|
path: "/v1/sites/{site_id}/git-credentials",
|
|
22978
23150
|
summary: "Create a Git credential",
|
|
22979
|
-
description: "A short-lived credential for `git clone`, `git pull`, and `git push` on one site's repository. A push makes a new version and builds it.
|
|
23151
|
+
description: "A short-lived credential for `git clone`, `git pull`, and `git push` on one site's repository. Making one needs the access to the site's source an Editor or Owner has. A push that moves main makes a new version and builds it, and Git prints whether the build started, or why the push was refused. When the build could not start, the next push that moves main records it and builds the newest version.",
|
|
23152
|
+
tool: "create_site_git_credential",
|
|
22980
23153
|
authenticated: true,
|
|
22981
23154
|
params: siteParams,
|
|
22982
|
-
response: {
|
|
22983
|
-
status: 201,
|
|
22984
|
-
description: "The credential.",
|
|
22985
|
-
schema: external_exports.object({
|
|
22986
|
-
clone_url: external_exports.string().describe("The site's Git address."),
|
|
22987
|
-
username: external_exports.string(),
|
|
22988
|
-
password: external_exports.string().describe("The token to give Git as the password. It is shown once."),
|
|
22989
|
-
expires_at: timestampSchema
|
|
22990
|
-
})
|
|
22991
|
-
},
|
|
23155
|
+
response: { status: 201, description: "The credential.", schema: createSiteGitCredentialOutput },
|
|
22992
23156
|
errors: SITE_ERRORS
|
|
22993
23157
|
},
|
|
22994
23158
|
{
|
|
@@ -23058,7 +23222,7 @@ import { createServer } from "node:http";
|
|
|
23058
23222
|
|
|
23059
23223
|
// src/version.ts
|
|
23060
23224
|
import { hostname as hostname3 } from "node:os";
|
|
23061
|
-
var CLI_VERSION = "0.1.
|
|
23225
|
+
var CLI_VERSION = "0.1.2";
|
|
23062
23226
|
var CLI_USER_AGENT = cliUserAgent(CLI_VERSION, cliComputerLabel(hostname3()));
|
|
23063
23227
|
|
|
23064
23228
|
// src/config.ts
|
|
@@ -23434,6 +23598,12 @@ var LOST_ANSWER_HINTS = {
|
|
|
23434
23598
|
};
|
|
23435
23599
|
var READS_SENT_AS_POST = /* @__PURE__ */ new Set(["readSiteRows", "readSiteEntries", "querySiteData"]);
|
|
23436
23600
|
var sleep = (ms) => new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
23601
|
+
var KNOWN_CAPABILITIES = new Set(SITE_CAPABILITIES);
|
|
23602
|
+
function withKnownCapabilities(operationId, body) {
|
|
23603
|
+
if (operationId !== "getSite" || body === null || typeof body !== "object" || !Array.isArray(body.capabilities)) return body;
|
|
23604
|
+
const capabilities = body.capabilities;
|
|
23605
|
+
return { ...body, capabilities: capabilities.filter((item) => typeof item !== "string" || KNOWN_CAPABILITIES.has(item)) };
|
|
23606
|
+
}
|
|
23437
23607
|
var Api = class {
|
|
23438
23608
|
/**
|
|
23439
23609
|
* `bestEffort` is for ending a sign-in that is not this computer's saved one: refreshing it never
|
|
@@ -23487,7 +23657,7 @@ var Api = class {
|
|
|
23487
23657
|
}
|
|
23488
23658
|
const body = await response.json().catch(() => null);
|
|
23489
23659
|
if (response.ok) {
|
|
23490
|
-
const parsed = contract.response.schema.safeParse(body);
|
|
23660
|
+
const parsed = contract.response.schema.safeParse(withKnownCapabilities(operationId, body));
|
|
23491
23661
|
if (parsed.success) return parsed.data;
|
|
23492
23662
|
if (contract.method === "get" || READS_SENT_AS_POST.has(operationId)) {
|
|
23493
23663
|
throw new CliError("The API answered in a shape this version of the CLI does not know.", "Update with `npx artifen@latest`, and try again.", "unexpected_response");
|
|
@@ -23925,6 +24095,15 @@ async function storeFile(api2, siteId2, file2, target, deps) {
|
|
|
23925
24095
|
await linkStep(deps, upload.url, "part", { method: "PUT", body: part }, `&upload=${uploadId}&part=${number4}&sha256=${sha256}`);
|
|
23926
24096
|
break;
|
|
23927
24097
|
} catch (error62) {
|
|
24098
|
+
if (error62 instanceof CliError && error62.code === "conflict" && error62.details?.reason === "sends_used") {
|
|
24099
|
+
const answer = await linkStep(deps, upload.url, "abort", { method: "POST" }, `&upload=${uploadId}`).then(
|
|
24100
|
+
(body) => body["aborted"] === true ? "ended" : "gone",
|
|
24101
|
+
() => "failed"
|
|
24102
|
+
);
|
|
24103
|
+
if (answer === "ended") throw new CliError("This upload was stopped because its parts were sent too many times. It was ended.", "Run the same command again, which begins the upload over.", "conflict");
|
|
24104
|
+
if (answer === "gone") throw new CliError("This upload was stopped because its parts were sent too many times. It had already ended or was completed by another send, so the file may be stored.", "Look at the site's stored files first: running the same command again begins a new upload, which replaces the file.", "conflict");
|
|
24105
|
+
throw new CliError("This upload was stopped because its parts were sent too many times. It could not be ended just now.", "Run the same command again to end it, then once more to begin the upload over.", "conflict");
|
|
24106
|
+
}
|
|
23928
24107
|
if (error62 instanceof CliError && error62.code === "conflict") {
|
|
23929
24108
|
throw new CliError(`Part ${number4} is still taken by a send that stopped.`, "Run the same command again in 10 minutes, when that send has lapsed, and it carries the upload on.", "conflict");
|
|
23930
24109
|
}
|
|
@@ -24465,7 +24644,7 @@ var COMMANDS = [
|
|
|
24465
24644
|
],
|
|
24466
24645
|
options: {
|
|
24467
24646
|
workspace: { type: "string", value: "<id>", help: "The workspace that will own the site. `npx artifen workspaces list` shows where you can create" },
|
|
24468
|
-
title: { type: "string", value: "<title>", help: "The site's title.
|
|
24647
|
+
title: { type: "string", value: "<title>", help: "The site's title. The site's address is made from it and stays when the title changes" },
|
|
24469
24648
|
template: { type: "boolean", help: "Start from the template app, with any folders or files given on top. It takes no name, since there is one template" },
|
|
24470
24649
|
...SENDING
|
|
24471
24650
|
},
|
|
@@ -24495,6 +24674,20 @@ ${describeSkipped(collected.skipped).join("\n")}` : "Pass a folder or files.", "
|
|
|
24495
24674
|
);
|
|
24496
24675
|
}
|
|
24497
24676
|
},
|
|
24677
|
+
{
|
|
24678
|
+
name: "sites leave",
|
|
24679
|
+
usage: "<site>",
|
|
24680
|
+
summary: "Remove yourself from a site shared with you.",
|
|
24681
|
+
details: ["Your role on it ends, and only its Owners can give it back. A site you reach through its workspace stays open to you: leaving it drops only a role of its own that raised you above the workspace's, such as the Editor role a transfer left you, and is refused otherwise."],
|
|
24682
|
+
options: {},
|
|
24683
|
+
args: { min: 1, max: 1 },
|
|
24684
|
+
signedIn: true,
|
|
24685
|
+
async run(context) {
|
|
24686
|
+
const id = siteId(context.args[0]);
|
|
24687
|
+
const result = await api(context).call("leaveSite", { params: { site_id: id } });
|
|
24688
|
+
return { json: result, text: [result.left ? `Left ${id}. Your role on it has ended.` : "That site is not shared with you, so nothing changed."] };
|
|
24689
|
+
}
|
|
24690
|
+
},
|
|
24498
24691
|
{
|
|
24499
24692
|
name: "sites delete",
|
|
24500
24693
|
usage: "<site>",
|
|
@@ -24705,7 +24898,7 @@ ${describeSkipped(collected.skipped).join("\n")}` : "Pass a folder or files.", "
|
|
|
24705
24898
|
summary: "Create a single-use upload link that puts one file into a site at a path, or with --stored keeps a large file such as video as one of a live app's stored files.",
|
|
24706
24899
|
details: [
|
|
24707
24900
|
`With a local file, it is sent through the link at once. Without one, the link is printed for a person to open in a browser and choose a file, or for a script to PUT the bytes to. It needs no sign-in and expires after ${UPLOAD_LINK_TTL_MS / 6e4} minutes. A file already at that path is replaced, with no read of it first as files write asks for.`,
|
|
24708
|
-
"With --stored, the second argument is the key of a live app's stored file, such as
|
|
24901
|
+
"With --stored, the second argument is the key of a live app's stored file, such as media/a.mp4, which its code lists and removes, served at /__artifen/files/<key>, up to the plan's max upload size. A local file is sent in parts, and running the command again carries an interrupted upload on. Without a local file, the link is printed for a person to open in a browser, and it works for a day."
|
|
24709
24902
|
],
|
|
24710
24903
|
options: {
|
|
24711
24904
|
stored: { type: "boolean", help: "Keep the file as a stored file at a key, served at /__artifen/files/<key>, rather than add it to the site's pages and code" },
|
|
@@ -24873,7 +25066,10 @@ ${describeSkipped(collected.skipped).join("\n")}` : "Pass a folder or files.", "
|
|
|
24873
25066
|
json: result,
|
|
24874
25067
|
text: [
|
|
24875
25068
|
...result.columns.length === 0 ? [] : table(rows),
|
|
24876
|
-
`${plural2(result.row_count, "row")} from the ${result.slot === "live" ? "published" : "preview"} database${result.truncated ? ", and more matched than were returned" : ""}
|
|
25069
|
+
`${plural2(result.row_count, "row")} from the ${result.slot === "live" ? "published" : "preview"} database${result.truncated ? ", and more matched than were returned" : ""}.`,
|
|
25070
|
+
...result.cut_for_size ? [
|
|
25071
|
+
result.row_count === 0 ? "The next row alone is larger than one answer. Select fewer or shorter columns, such as a substr of a long one." : `Rows past these were left out to keep the answer within ${DATA_TOOL_ANSWER_BYTES / 1e3} KB. Page the query with the same ORDER BY every time, ending in a unique column, as LIMIT n OFFSET m with m moved on by ${result.row_count}, and if this query had no such order, start again from its first page with one.`
|
|
25072
|
+
] : []
|
|
24877
25073
|
]
|
|
24878
25074
|
};
|
|
24879
25075
|
}
|
|
@@ -24883,7 +25079,7 @@ ${describeSkipped(collected.skipped).join("\n")}` : "Pass a folder or files.", "
|
|
|
24883
25079
|
usage: "<site> <table>",
|
|
24884
25080
|
summary: "Read a page of rows from one table of a live app's database.",
|
|
24885
25081
|
details: [
|
|
24886
|
-
'Each --where is one condition every row meets, as JSON: {"column":"
|
|
25082
|
+
'Each --where is one condition every row meets, as JSON: {"column":"id","op":"gt","value":100}. op is eq, ne, lt, lte, gt, gte, in (with "values"), is_null, or not_null.',
|
|
24887
25083
|
"When more rows match, the last line gives the --cursor that reads the next page, with the same table, --where, --order-by, and --desc. A binary cell prints as <binary>, and --json gives it as base64. An integer larger than 9007199254740991 prints by its digits, and --json gives it as { integer: digits }, which --where takes back."
|
|
24888
25084
|
],
|
|
24889
25085
|
options: {
|
|
@@ -24901,7 +25097,7 @@ ${describeSkipped(collected.skipped).join("\n")}` : "Pass a folder or files.", "
|
|
|
24901
25097
|
try {
|
|
24902
25098
|
return JSON.parse(condition);
|
|
24903
25099
|
} catch {
|
|
24904
|
-
throw usageError(`--where takes JSON, such as {"column":"
|
|
25100
|
+
throw usageError(`--where takes JSON, such as {"column":"id","op":"gt","value":100}: ${condition}`);
|
|
24905
25101
|
}
|
|
24906
25102
|
});
|
|
24907
25103
|
const result = await api(context).call("readSiteRows", {
|
|
@@ -24933,7 +25129,7 @@ ${describeSkipped(collected.skipped).join("\n")}` : "Pass a folder or files.", "
|
|
|
24933
25129
|
usage: "<site> [file]",
|
|
24934
25130
|
summary: "Insert, update, and delete rows in a live app's tables as one batch.",
|
|
24935
25131
|
details: [
|
|
24936
|
-
'The batch is JSON, from the file or piped in: {"writes":[{"op":"insert","table":"
|
|
25132
|
+
'The batch is JSON, from the file or piped in: {"writes":[{"op":"insert","table":"items","values":{"name":"a"}}]}, or just the list of writes. An update has "where" and "set", and a delete has "where", each a list of conditions as --where of rows read takes them.',
|
|
24937
25133
|
"Every write applies, or none does, and pages showing those rows update at once. Sending the same inserts again adds them again."
|
|
24938
25134
|
],
|
|
24939
25135
|
options: {
|
|
@@ -24958,7 +25154,7 @@ ${describeSkipped(collected.skipped).join("\n")}` : "Pass a folder or files.", "
|
|
|
24958
25154
|
try {
|
|
24959
25155
|
batch = JSON.parse(raw);
|
|
24960
25156
|
} catch {
|
|
24961
|
-
throw usageError('The writes are JSON, such as {"writes":[{"op":"insert","table":"
|
|
25157
|
+
throw usageError('The writes are JSON, such as {"writes":[{"op":"insert","table":"items","values":{"name":"a"}}]}.');
|
|
24962
25158
|
}
|
|
24963
25159
|
const writes = Array.isArray(batch) ? batch : batch?.writes;
|
|
24964
25160
|
const result = await api(context).call("writeSiteRows", {
|
|
@@ -24976,7 +25172,7 @@ ${describeSkipped(collected.skipped).join("\n")}` : "Pass a folder or files.", "
|
|
|
24976
25172
|
usage: "<site> <collection>",
|
|
24977
25173
|
summary: "Read a page of entries from one collection of a site's data store.",
|
|
24978
25174
|
details: [
|
|
24979
|
-
`Each --where is one filter on a top-level field of every entry's value, as JSON: {"field":"
|
|
25175
|
+
`Each --where is one filter on a top-level field of every entry's value, as JSON: {"field":"name","op":"eq","value":"a"}. op is eq, ne, lt, lte, gt, gte, in (with "values"), is_null, or not_null. A field the value lacks is null, and a comparison holds only between values of one JSON type.`,
|
|
24980
25176
|
"Entries come in ID order, and IDs from an add sort by when it was added, so --desc lists the newest first. You read as yourself, under the collection's rules. In a collection kept per person, an Editor or Owner gets every person's entries, ordered by person and then ID, each with the person it belongs to, or one person's with --person, and anyone else gets their own. When more entries match, the last line gives the --cursor that reads the next page, with the same collection, --person, --where, and --desc."
|
|
24981
25177
|
],
|
|
24982
25178
|
options: {
|
|
@@ -24994,7 +25190,7 @@ ${describeSkipped(collected.skipped).join("\n")}` : "Pass a folder or files.", "
|
|
|
24994
25190
|
try {
|
|
24995
25191
|
return JSON.parse(filter);
|
|
24996
25192
|
} catch {
|
|
24997
|
-
throw usageError(`--where takes JSON, such as {"field":"
|
|
25193
|
+
throw usageError(`--where takes JSON, such as {"field":"name","op":"eq","value":"a"}: ${filter}`);
|
|
24998
25194
|
}
|
|
24999
25195
|
});
|
|
25000
25196
|
const result = await api(context).call("readSiteEntries", {
|
|
@@ -25029,7 +25225,7 @@ ${describeSkipped(collected.skipped).join("\n")}` : "Pass a folder or files.", "
|
|
|
25029
25225
|
usage: "<site> [file]",
|
|
25030
25226
|
summary: "Save, add, and remove entries in a site's data store as one batch.",
|
|
25031
25227
|
details: [
|
|
25032
|
-
`The batch is JSON, from the file or piped in: {"writes":[{"op":"add","collection":"
|
|
25228
|
+
`The batch is JSON, from the file or piped in: {"writes":[{"op":"add","collection":"items","value":{"name":"a"}}]}, or just the list of changes. A set has "collection", "id", and "value", an add "collection" and "value", and a remove "collection" and "id". In a collection kept per person, a change names "person" to change that person's entries, which only an Editor or Owner may do, or leaves it out to change your own.`,
|
|
25033
25229
|
"Every change is made, or none is, as you, under each collection's rules. Sending the same adds again adds them again."
|
|
25034
25230
|
],
|
|
25035
25231
|
options: {
|
|
@@ -25054,7 +25250,7 @@ ${describeSkipped(collected.skipped).join("\n")}` : "Pass a folder or files.", "
|
|
|
25054
25250
|
try {
|
|
25055
25251
|
batch = JSON.parse(raw);
|
|
25056
25252
|
} catch {
|
|
25057
|
-
throw usageError('The changes are JSON, such as {"writes":[{"op":"add","collection":"
|
|
25253
|
+
throw usageError('The changes are JSON, such as {"writes":[{"op":"add","collection":"items","value":{"name":"a"}}]}.');
|
|
25058
25254
|
}
|
|
25059
25255
|
const writes = Array.isArray(batch) ? batch : batch?.writes;
|
|
25060
25256
|
const result = await api(context).call("writeSiteEntries", {
|
|
@@ -25288,13 +25484,81 @@ ${describeSkipped(collected.skipped).join("\n")}` : "Pass a folder or files.", "
|
|
|
25288
25484
|
return { json: result, text: ["Deleted the data key. Requests carrying it are refused from then on."] };
|
|
25289
25485
|
}
|
|
25290
25486
|
},
|
|
25487
|
+
{
|
|
25488
|
+
name: "transfers send",
|
|
25489
|
+
usage: "<site> <email-or-workspace-id>",
|
|
25490
|
+
summary: "Send a site to a person by email, or to another workspace. The site keeps its address.",
|
|
25491
|
+
details: [
|
|
25492
|
+
"A person takes it into a workspace they own, signed in with that email address once they have confirmed it. A workspace's Owners take it into that workspace. When you own the destination workspace too, the site moves at once.",
|
|
25493
|
+
`Otherwise it stays where it is until it is accepted, for up to ${SITE_TRANSFER_TTL_DAYS} days. It keeps ${SITE_TRANSFER_KEEPS}, and when it moves, ${SITE_TRANSFER_ENDS} end. ${SITE_TRANSFER_PEOPLE}. You stay on it as an Editor unless you own the destination, and its payments go to the destination workspace's own payments account. Only an Owner of the site sends one, a transfer is dropped if they stop being an Owner of it, and sending again replaces the one waiting. One person sends at most 20 by email a day.`
|
|
25494
|
+
],
|
|
25495
|
+
options: {},
|
|
25496
|
+
args: { min: 2, max: 2 },
|
|
25497
|
+
signedIn: true,
|
|
25498
|
+
async run(context) {
|
|
25499
|
+
const to = context.args[1];
|
|
25500
|
+
const result = await api(context).call("transferSite", {
|
|
25501
|
+
params: { site_id: siteId(context.args[0]) },
|
|
25502
|
+
body: to.includes("@") ? { to_email: to } : { to_workspace_id: to }
|
|
25503
|
+
});
|
|
25504
|
+
if (result.moved !== null) return { json: result, text: [`Moved the site into ${result.moved.workspace.name}. Its address is the same.`] };
|
|
25505
|
+
const recipient = result.transfer.to.email ?? result.transfer.to.workspace.name;
|
|
25506
|
+
return { json: result, text: [`Sent the site to ${recipient}. It stays here until they accept it, and they have until ${when(result.transfer.expires_at)}. Transfer ID: ${result.transfer.id}`] };
|
|
25507
|
+
}
|
|
25508
|
+
},
|
|
25509
|
+
{
|
|
25510
|
+
name: "transfers list",
|
|
25511
|
+
usage: "",
|
|
25512
|
+
summary: "List site transfers waiting: those sent to you or to a workspace you own, and those of sites in a workspace you own.",
|
|
25513
|
+
options: { site: { type: "string", value: "<site>", help: "Only this site's transfer" } },
|
|
25514
|
+
args: { min: 0, max: 0 },
|
|
25515
|
+
signedIn: true,
|
|
25516
|
+
async run(context) {
|
|
25517
|
+
const site = text(context, "site");
|
|
25518
|
+
const result = await api(context).call("listSiteTransfers", { query: site === void 0 ? {} : { site_id: siteId(site) } });
|
|
25519
|
+
if (result.transfers.length === 0) return { json: result, text: ["No site transfers are waiting."] };
|
|
25520
|
+
const rows = result.transfers.map((transfer) => [
|
|
25521
|
+
transfer.id,
|
|
25522
|
+
transfer.direction === "incoming" ? "sent to you" : "sent from your workspace",
|
|
25523
|
+
transfer.site.title,
|
|
25524
|
+
transfer.direction === "incoming" ? `from ${transfer.sent_by.name ?? transfer.sent_by.email ?? transfer.from_workspace.name}` : `to ${transfer.to.email ?? transfer.to.workspace.name}`,
|
|
25525
|
+
`expires ${when(transfer.expires_at)}${transfer.direction === "outgoing" && transfer.email_delivery === "failed" ? ", email not sent" : ""}`
|
|
25526
|
+
]);
|
|
25527
|
+
return { json: result, text: table(rows) };
|
|
25528
|
+
}
|
|
25529
|
+
},
|
|
25530
|
+
{
|
|
25531
|
+
name: "transfers accept",
|
|
25532
|
+
usage: "<transfer-id> [workspace-id]",
|
|
25533
|
+
summary: "Take a site sent to you into a workspace you own.",
|
|
25534
|
+
details: ["The transfer's ID is the first column of `transfers list`, and a workspace's ID comes from `workspaces list`. A site sent to you by email needs the workspace to take it into, and one sent to a workspace goes into that workspace. The workspace's plan must have room for the site."],
|
|
25535
|
+
options: {},
|
|
25536
|
+
args: { min: 1, max: 2 },
|
|
25537
|
+
signedIn: true,
|
|
25538
|
+
async run(context) {
|
|
25539
|
+
const result = await api(context).call("acceptSiteTransfer", { params: { transfer_id: context.args[0] }, body: context.args[1] === void 0 ? {} : { workspace_id: context.args[1] } });
|
|
25540
|
+
return { json: result, text: [`Took the site ${result.moved.site_id} into ${result.moved.workspace.name}. Its address is the same.`] };
|
|
25541
|
+
}
|
|
25542
|
+
},
|
|
25543
|
+
{
|
|
25544
|
+
name: "transfers cancel",
|
|
25545
|
+
usage: "<transfer-id>",
|
|
25546
|
+
summary: "Cancel a transfer of a site in a workspace you own, or decline one sent to you.",
|
|
25547
|
+
options: {},
|
|
25548
|
+
args: { min: 1, max: 1 },
|
|
25549
|
+
signedIn: true,
|
|
25550
|
+
async run(context) {
|
|
25551
|
+
const result = await api(context).call("cancelSiteTransfer", { params: { transfer_id: context.args[0] } });
|
|
25552
|
+
return { json: result, text: [result.cancelled ? "Cancelled or declined the transfer. The site stays where it is." : "That transfer is no longer waiting, so nothing changed."] };
|
|
25553
|
+
}
|
|
25554
|
+
},
|
|
25291
25555
|
{
|
|
25292
25556
|
name: "comments list",
|
|
25293
25557
|
usage: "<site>",
|
|
25294
25558
|
summary: "List the comments people left on a site's pages, with their replies.",
|
|
25295
25559
|
options: {
|
|
25296
25560
|
status: { type: "string", value: "<status>", help: "open (the default), resolved, or all" },
|
|
25297
|
-
page: { type: "string", value: "<path>", help: "Only comments on this page of the site, such as /
|
|
25561
|
+
page: { type: "string", value: "<path>", help: "Only comments on this page of the site, such as /about" },
|
|
25298
25562
|
...PAGING
|
|
25299
25563
|
},
|
|
25300
25564
|
args: { min: 1, max: 1 },
|
|
@@ -25400,8 +25664,9 @@ var GLOBAL_OPTIONS = {
|
|
|
25400
25664
|
};
|
|
25401
25665
|
var GROUPS = [
|
|
25402
25666
|
{ title: "Sign in", names: ["login", "logout"] },
|
|
25403
|
-
{ title: "Workspaces and sites", names: ["workspaces list", "sites list", "sites get", "sites create", "sites delete", "sites restore", "sites archive", "sites unarchive", "sites pin", "sites unpin", "sites publish"] },
|
|
25667
|
+
{ title: "Workspaces and sites", names: ["workspaces list", "sites list", "sites get", "sites create", "sites delete", "sites leave", "sites restore", "sites archive", "sites unarchive", "sites pin", "sites unpin", "sites publish"] },
|
|
25404
25668
|
{ title: "Files", names: ["files read", "files write", "files edit", "files patch", "files delete", "files upload"] },
|
|
25669
|
+
{ title: "Moving sites", names: ["transfers send", "transfers list", "transfers accept", "transfers cancel"] },
|
|
25405
25670
|
{ title: "History", names: ["versions list", "versions restore"] },
|
|
25406
25671
|
{ title: "Running sites", names: ["logs build", "logs server", "insights read", "insights history", "data query", "rows read", "rows write", "entries read", "entries write", "secrets set", "secrets delete", "comments list", "comments reply"] },
|
|
25407
25672
|
{ title: "Keys for scripts", names: ["keys create", "keys list", "keys delete", "keys temporary", "data-keys create", "data-keys list", "data-keys renew", "data-keys delete"] },
|