@zixt/host 0.0.21 → 0.0.22
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/index.js +8 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ import { homedir } from "node:os";
|
|
|
31
31
|
// package.json
|
|
32
32
|
var package_default = {
|
|
33
33
|
name: "@zixt/host",
|
|
34
|
-
version: "0.0.
|
|
34
|
+
version: "0.0.22",
|
|
35
35
|
type: "module",
|
|
36
36
|
exports: {
|
|
37
37
|
".": "./src/client.ts",
|
|
@@ -16998,7 +16998,7 @@ var GithubOperationGrant = external_exports.discriminatedUnion("operation", [
|
|
|
16998
16998
|
provider: external_exports.literal("github"),
|
|
16999
16999
|
operation: external_exports.literal("repository.clone_created"),
|
|
17000
17000
|
accessToken: external_exports.string().min(1).max(1e4),
|
|
17001
|
-
expiresAt: IsoDate,
|
|
17001
|
+
expiresAt: IsoDate.nullable(),
|
|
17002
17002
|
installationId: GithubNumericId,
|
|
17003
17003
|
repositoryId: GithubNumericId,
|
|
17004
17004
|
repository: GithubRepositoryGrant,
|
|
@@ -17013,7 +17013,7 @@ var GithubOperationGrant = external_exports.discriminatedUnion("operation", [
|
|
|
17013
17013
|
provider: external_exports.literal("github"),
|
|
17014
17014
|
operation: external_exports.literal("repository.activate"),
|
|
17015
17015
|
accessToken: external_exports.string().min(1).max(1e4),
|
|
17016
|
-
expiresAt: IsoDate,
|
|
17016
|
+
expiresAt: IsoDate.nullable(),
|
|
17017
17017
|
installationId: GithubNumericId,
|
|
17018
17018
|
repositoryId: GithubNumericId,
|
|
17019
17019
|
repository: GithubRepositoryGrant,
|
|
@@ -20301,7 +20301,7 @@ var HostClient = class _HostClient {
|
|
|
20301
20301
|
}
|
|
20302
20302
|
const { grant } = frame;
|
|
20303
20303
|
const repositoryMatches = waiter.request.operation === "repository.create" ? grant.operation === "repository.create" : waiter.request.operation === "repository.clone_created" ? grant.operation === "repository.clone_created" && grant.repositoryId === waiter.request.repositoryId : grant.operation === "repository.activate" && (waiter.request.repositoryId !== void 0 ? grant.repositoryId === waiter.request.repositoryId : grant.repository.fullName === waiter.request.fullName);
|
|
20304
|
-
if (grant.provider !== waiter.request.provider || grant.operation !== waiter.request.operation || grant.installationId !== waiter.installationId || !repositoryMatches || Date.parse(grant.expiresAt) <= Date.now()) {
|
|
20304
|
+
if (grant.provider !== waiter.request.provider || grant.operation !== waiter.request.operation || grant.installationId !== waiter.installationId || !repositoryMatches || grant.expiresAt !== null && Date.parse(grant.expiresAt) <= Date.now()) {
|
|
20305
20305
|
return;
|
|
20306
20306
|
}
|
|
20307
20307
|
clearTimeout(waiter.timer);
|
|
@@ -27463,7 +27463,7 @@ function parseArgs(raw) {
|
|
|
27463
27463
|
}
|
|
27464
27464
|
function validateOperationGrant(value, input) {
|
|
27465
27465
|
const parsed = GithubOperationGrant.parse(value);
|
|
27466
|
-
if (parsed.operation !== input.operation || parsed.installationId !== input.installationId || Date.parse(parsed.expiresAt) <= input.now.getTime()) {
|
|
27466
|
+
if (parsed.operation !== input.operation || parsed.installationId !== input.installationId || parsed.expiresAt !== null && Date.parse(parsed.expiresAt) <= input.now.getTime()) {
|
|
27467
27467
|
throw new GithubInputError("GitHub operation grant does not match this task");
|
|
27468
27468
|
}
|
|
27469
27469
|
if (input.operation === "repository.clone_created" && (parsed.operation !== "repository.clone_created" || parsed.repositoryId !== input.repositoryId)) {
|
|
@@ -29546,7 +29546,7 @@ function createGithubToolPackFactory(options = {}) {
|
|
|
29546
29546
|
stage = "checking the repository credentials Zixt returned";
|
|
29547
29547
|
if (operationGrant.operation !== "repository.activate" || operationGrant.installationId !== grant.installationId || operationGrant.operations.some(
|
|
29548
29548
|
(operation) => !locallySupportedOperations.has(operation)
|
|
29549
|
-
) || Date.parse(operationGrant.expiresAt) <= now().getTime() || selector.repositoryId !== void 0 && operationGrant.repositoryId !== selector.repositoryId || selector.fullName !== void 0 && operationGrant.repository.fullName !== selector.fullName) {
|
|
29549
|
+
) || operationGrant.expiresAt !== null && Date.parse(operationGrant.expiresAt) <= now().getTime() || selector.repositoryId !== void 0 && operationGrant.repositoryId !== selector.repositoryId || selector.fullName !== void 0 && operationGrant.repository.fullName !== selector.fullName) {
|
|
29550
29550
|
return { ok: false, error: "GitHub returned invalid repository authority." };
|
|
29551
29551
|
}
|
|
29552
29552
|
const [owner] = operationGrant.repository.fullName.split("/");
|
|
@@ -32066,6 +32066,7 @@ function credentialFromTaskGrant(grant, allowed) {
|
|
|
32066
32066
|
return { accessToken: grant.accessToken, expiresAt };
|
|
32067
32067
|
}
|
|
32068
32068
|
function activationCredential(grant, now = Date.now()) {
|
|
32069
|
+
if (grant.expiresAt === null) return { accessToken: grant.accessToken, expiresAt: null };
|
|
32069
32070
|
const expiresAt = new Date(grant.expiresAt);
|
|
32070
32071
|
return expiresAt.getTime() <= now ? null : { accessToken: grant.accessToken, expiresAt };
|
|
32071
32072
|
}
|
|
@@ -32170,7 +32171,7 @@ async function createGithubShellAuth(input) {
|
|
|
32170
32171
|
const refreshes = /* @__PURE__ */ new Map();
|
|
32171
32172
|
const liveOperationActivation = (repositoryId2) => {
|
|
32172
32173
|
const candidates = (input.operationGrants?.() ?? []).filter(
|
|
32173
|
-
(grant) => grant.operation === "repository.activate" && grant.installationId === input.initialGrant.installationId && grant.repositoryId === repositoryId2 && Date.parse(grant.expiresAt) > now()
|
|
32174
|
+
(grant) => grant.operation === "repository.activate" && grant.installationId === input.initialGrant.installationId && grant.repositoryId === repositoryId2 && (grant.expiresAt === null || Date.parse(grant.expiresAt) > now())
|
|
32174
32175
|
);
|
|
32175
32176
|
return candidates.at(-1) ?? null;
|
|
32176
32177
|
};
|