@tinycloud/operations 0.5.2-beta.1 → 0.5.3-beta.0
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/cli-name.cjs +32 -0
- package/dist/cli-name.cjs.map +1 -0
- package/dist/cli-name.d.cts +9 -0
- package/dist/cli-name.d.ts +9 -0
- package/dist/cli-name.js +7 -0
- package/dist/cli-name.js.map +1 -0
- package/dist/cli-runtime.cjs +83 -68
- package/dist/cli-runtime.cjs.map +1 -1
- package/dist/cli-runtime.js +28 -13
- package/dist/cli-runtime.js.map +1 -1
- package/dist/index.cjs +83 -68
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +28 -13
- package/dist/index.js.map +1 -1
- package/dist/recovery.cjs +11 -5
- package/dist/recovery.cjs.map +1 -1
- package/dist/recovery.js +9 -5
- package/dist/recovery.js.map +1 -1
- package/dist/secret-request.cjs +7 -1
- package/dist/secret-request.cjs.map +1 -1
- package/dist/secret-request.js +7 -1
- package/dist/secret-request.js.map +1 -1
- package/package.json +10 -5
package/dist/index.js
CHANGED
|
@@ -33,6 +33,16 @@ var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__
|
|
|
33
33
|
));
|
|
34
34
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
35
35
|
|
|
36
|
+
// src/cli-name.ts
|
|
37
|
+
import { basename } from "path";
|
|
38
|
+
var CLI_NAME;
|
|
39
|
+
var init_cli_name = __esm({
|
|
40
|
+
"src/cli-name.ts"() {
|
|
41
|
+
"use strict";
|
|
42
|
+
CLI_NAME = basename(process.argv[1] ?? "") === "tinycloud" ? "tinycloud" : "tc";
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
36
46
|
// ../sdk-core/src/policy/errors.ts
|
|
37
47
|
var SignedObjectProfileError, SignedObjectCanonicalizationError;
|
|
38
48
|
var init_errors = __esm({
|
|
@@ -4252,7 +4262,7 @@ import {
|
|
|
4252
4262
|
} from "fs/promises";
|
|
4253
4263
|
import { connect, createServer } from "net";
|
|
4254
4264
|
import { homedir } from "os";
|
|
4255
|
-
import { basename, dirname, isAbsolute, join, relative, resolve } from "path";
|
|
4265
|
+
import { basename as basename2, dirname, isAbsolute, join, relative, resolve } from "path";
|
|
4256
4266
|
function processWideContext(key) {
|
|
4257
4267
|
var _a4;
|
|
4258
4268
|
const registry = globalThis;
|
|
@@ -4321,7 +4331,7 @@ async function bindLiveness(directory) {
|
|
|
4321
4331
|
await rename(pinned.path(`${socket}.new`), pinned.path(socket));
|
|
4322
4332
|
const stats = await lstat(pinned.path(socket), { bigint: true });
|
|
4323
4333
|
if (!stats.isSocket()) throw new Error(`${socket} is not a socket`);
|
|
4324
|
-
await waitForTestBarrier(TEST_LOCK_LIVENESS_BARRIER_DIR,
|
|
4334
|
+
await waitForTestBarrier(TEST_LOCK_LIVENESS_BARRIER_DIR, basename2(directory));
|
|
4325
4335
|
return { record: { socket, dev: String(stats.dev), ino: String(stats.ino) }, path: join(directory, socket), server };
|
|
4326
4336
|
} catch {
|
|
4327
4337
|
if (bound) {
|
|
@@ -4466,7 +4476,7 @@ async function replaceJson(filePath, value, durable) {
|
|
|
4466
4476
|
const directory = dirname(filePath);
|
|
4467
4477
|
const temporaryPath = join(
|
|
4468
4478
|
directory,
|
|
4469
|
-
`.${
|
|
4479
|
+
`.${basename2(filePath)}.${process.pid}.${randomUUID()}.tmp`
|
|
4470
4480
|
);
|
|
4471
4481
|
const contents = `${JSON.stringify(value, null, 2)}
|
|
4472
4482
|
`;
|
|
@@ -4788,7 +4798,7 @@ async function markTurn(path, token, kind) {
|
|
|
4788
4798
|
async function createTurnDirectory(directory) {
|
|
4789
4799
|
const token = randomUUID();
|
|
4790
4800
|
const owner = { pid: process.pid, createdAt: (/* @__PURE__ */ new Date()).toISOString(), token, after: null, ...processOwner(null) };
|
|
4791
|
-
await publishDirectory(join(dirname(directory), `.stage-${
|
|
4801
|
+
await publishDirectory(join(dirname(directory), `.stage-${basename2(directory)}-${process.pid}-${token}`), directory, {
|
|
4792
4802
|
"0/owner.json": `${JSON.stringify(owner, null, 2)}
|
|
4793
4803
|
`,
|
|
4794
4804
|
[`0/${token}.held`]: "",
|
|
@@ -5455,7 +5465,7 @@ function isSafeRecovery(value, action) {
|
|
|
5455
5465
|
if (!("command" in record)) return true;
|
|
5456
5466
|
const command = record.command;
|
|
5457
5467
|
if (typeof command !== "string") return false;
|
|
5458
|
-
const profile =
|
|
5468
|
+
const profile = /^\S+ --profile (\S+) /.exec(command)?.[1];
|
|
5459
5469
|
if (profile === void 0 || !SAFE_PROFILE_TOKEN.test(profile)) return false;
|
|
5460
5470
|
return action === "sign_in" ? Object.values(SIGN_IN_TEMPLATES).some((template) => template(profile) === command) : migrationCommand(profile) === command;
|
|
5461
5471
|
}
|
|
@@ -5463,14 +5473,15 @@ var SAFE_PROFILE_TOKEN, MIGRATION_OPERATION_ID, SIGN_IN_TEMPLATES, migrationComm
|
|
|
5463
5473
|
var init_recovery = __esm({
|
|
5464
5474
|
"src/recovery.ts"() {
|
|
5465
5475
|
"use strict";
|
|
5476
|
+
init_cli_name();
|
|
5466
5477
|
SAFE_PROFILE_TOKEN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
|
|
5467
5478
|
MIGRATION_OPERATION_ID = "tinycloud.auth.capabilities";
|
|
5468
5479
|
SIGN_IN_TEMPLATES = {
|
|
5469
|
-
local: (profile) =>
|
|
5470
|
-
openkey: (profile) =>
|
|
5471
|
-
scoped: (profile) =>
|
|
5480
|
+
local: (profile) => `${CLI_NAME} --profile ${profile} auth login --method local`,
|
|
5481
|
+
openkey: (profile) => `${CLI_NAME} --profile ${profile} auth login --method openkey`,
|
|
5482
|
+
scoped: (profile) => `${CLI_NAME} --profile ${profile} auth login --method openkey --paste --manifest <manifest.json>`
|
|
5472
5483
|
};
|
|
5473
|
-
migrationCommand = (profile) =>
|
|
5484
|
+
migrationCommand = (profile) => `${CLI_NAME} --profile ${profile} auth caps`;
|
|
5474
5485
|
}
|
|
5475
5486
|
});
|
|
5476
5487
|
|
|
@@ -6972,7 +6983,7 @@ function ownerOfSpace(space) {
|
|
|
6972
6983
|
return ownerOrUndefined(`did:pkh:eip155:${match[1]}:${match[2].toLowerCase()}`);
|
|
6973
6984
|
}
|
|
6974
6985
|
function putCommands(names, scope) {
|
|
6975
|
-
return dedupe(names).map((name) =>
|
|
6986
|
+
return dedupe(names).map((name) => `${CLI_NAME} secrets put ${name}${scope === void 0 ? "" : ` --scope ${scope}`} --stdin`).join("; ");
|
|
6976
6987
|
}
|
|
6977
6988
|
function dedupe(names) {
|
|
6978
6989
|
return [...new Set(names)];
|
|
@@ -6984,6 +6995,7 @@ var SECRET_MANAGER_ORIGIN, SECRET_REQUEST_MAX_NAMES, SECRET_REQUEST_MAX_URL_LENG
|
|
|
6984
6995
|
var init_secret_request = __esm({
|
|
6985
6996
|
"src/secret-request.ts"() {
|
|
6986
6997
|
"use strict";
|
|
6998
|
+
init_cli_name();
|
|
6987
6999
|
SECRET_MANAGER_ORIGIN = "https://secrets.tinycloud.xyz";
|
|
6988
7000
|
SECRET_REQUEST_MAX_NAMES = 10;
|
|
6989
7001
|
SECRET_REQUEST_MAX_URL_LENGTH = 8192;
|
|
@@ -7093,7 +7105,7 @@ function classifySecretRead(reference, result, localOwner) {
|
|
|
7093
7105
|
approval: {
|
|
7094
7106
|
kind: "openkey",
|
|
7095
7107
|
requestId: "runtime-hint",
|
|
7096
|
-
fallback:
|
|
7108
|
+
fallback: `${CLI_NAME} auth grant <request-artifact>`
|
|
7097
7109
|
}
|
|
7098
7110
|
};
|
|
7099
7111
|
case "node_unreachable":
|
|
@@ -7195,6 +7207,7 @@ var SecretsGetInputSchema, SecretsGetOutputSchema, SECRETS_GET_POSTURES, SECRETS
|
|
|
7195
7207
|
var init_secrets_get = __esm({
|
|
7196
7208
|
"src/operations/secrets-get.ts"() {
|
|
7197
7209
|
"use strict";
|
|
7210
|
+
init_cli_name();
|
|
7198
7211
|
init_errors2();
|
|
7199
7212
|
init_secret_request();
|
|
7200
7213
|
init_secrets();
|
|
@@ -8824,7 +8837,7 @@ async function createRestoredRuntime(target, resolved) {
|
|
|
8824
8837
|
)) {
|
|
8825
8838
|
return failed(summary, operationError(
|
|
8826
8839
|
"PROFILE_MIGRATION_REQUIRED",
|
|
8827
|
-
`Profile "${profileName}" has a one-time stored-grant upgrade to finish. Run one authenticated command on it (
|
|
8840
|
+
`Profile "${profileName}" has a one-time stored-grant upgrade to finish. Run one authenticated command on it (${CLI_NAME} --profile <profile> auth caps), then retry.`,
|
|
8828
8841
|
{ retryable: false, details: { recovery: migrationRecovery(profileName) } }
|
|
8829
8842
|
));
|
|
8830
8843
|
}
|
|
@@ -8934,6 +8947,7 @@ function unresolvedSummary(target) {
|
|
|
8934
8947
|
var init_runtime = __esm({
|
|
8935
8948
|
"src/runtime.ts"() {
|
|
8936
8949
|
"use strict";
|
|
8950
|
+
init_cli_name();
|
|
8937
8951
|
init_authority();
|
|
8938
8952
|
init_errors2();
|
|
8939
8953
|
init_profile();
|
|
@@ -8945,6 +8959,7 @@ var init_runtime = __esm({
|
|
|
8945
8959
|
});
|
|
8946
8960
|
|
|
8947
8961
|
// src/invoke.ts
|
|
8962
|
+
init_cli_name();
|
|
8948
8963
|
init_jcs();
|
|
8949
8964
|
init_errors2();
|
|
8950
8965
|
init_authority();
|
|
@@ -9643,7 +9658,7 @@ function approvalAction(request, node) {
|
|
|
9643
9658
|
kind: "openkey",
|
|
9644
9659
|
requestId: request.requestId,
|
|
9645
9660
|
...url === void 0 ? {} : { url },
|
|
9646
|
-
fallback:
|
|
9661
|
+
fallback: `${CLI_NAME} auth grant <request-artifact>`
|
|
9647
9662
|
};
|
|
9648
9663
|
}
|
|
9649
9664
|
function exactCapabilities2(value) {
|