@primitive.ai/prim 0.1.0-alpha.76 → 0.1.0-alpha.77

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.
@@ -27853,7 +27853,8 @@ function validate42(data, { instancePath = "", parentData, parentDataProperty, r
27853
27853
  return errors === 0;
27854
27854
  }
27855
27855
  validate42.evaluated = { "dynamicProps": true, "dynamicItems": false };
27856
- var schema77 = { "anyOf": [{ "type": "object", "properties": { "error": { "type": "string", "const": "Unauthorized" } }, "required": ["error"], "additionalProperties": false }, { "type": "object", "properties": { "error": { "type": "string", "const": "interactive_workos_authority_required" } }, "required": ["error"], "additionalProperties": false }, { "type": "object", "properties": { "error": { "type": "string", "const": "feature_disabled" }, "feature": { "type": "string", "const": "github-connect" } }, "required": ["error", "feature"], "additionalProperties": false }, { "type": "object", "properties": { "error": { "type": "string", "enum": ["github_connect_unavailable", "feature_check_unavailable"] }, "feature": { "type": "string", "const": "github-connect" } }, "required": ["error", "feature"], "additionalProperties": false }, { "type": "object", "properties": { "error": { "type": "string", "const": "github_install_intent_conflict" } }, "required": ["error"], "additionalProperties": false }] };
27856
+ var isGitHubInstallIntentStartErrorResponse = validate43;
27857
+ var schema77 = { "anyOf": [{ "type": "object", "properties": { "error": { "type": "string", "const": "Unauthorized" } }, "required": ["error"], "additionalProperties": false }, { "type": "object", "properties": { "error": { "type": "string", "const": "interactive_workos_authority_required" } }, "required": ["error"], "additionalProperties": false }, { "type": "object", "properties": { "error": { "type": "string", "const": "feature_disabled" }, "feature": { "type": "string", "const": "github-connect" } }, "required": ["error", "feature"], "additionalProperties": false }, { "type": "object", "properties": { "error": { "type": "string", "enum": ["github_connect_unavailable", "feature_check_unavailable"] }, "feature": { "type": "string", "const": "github-connect" } }, "required": ["error", "feature"], "additionalProperties": false }, { "type": "object", "properties": { "error": { "type": "string", "const": "WorkOS identity authority is temporarily unavailable" } }, "required": ["error"], "additionalProperties": false }, { "type": "object", "properties": { "error": { "type": "string", "const": "github_install_intent_conflict" } }, "required": ["error"], "additionalProperties": false }, { "type": "object", "properties": { "error": { "type": "string", "const": "github_install_intent_rate_limited" }, "retryAt": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "required": ["error", "retryAt"], "additionalProperties": false }] };
27857
27858
  function validate43(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
27858
27859
  ;
27859
27860
  let vErrors = null;
@@ -28233,8 +28234,8 @@ function validate43(data, { instancePath = "", parentData, parentDataProperty, r
28233
28234
  }
28234
28235
  errors++;
28235
28236
  }
28236
- if ("github_install_intent_conflict" !== data6) {
28237
- const err27 = { instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/4/properties/error/const", keyword: "const", params: { allowedValue: "github_install_intent_conflict" }, message: "must be equal to constant" };
28237
+ if ("WorkOS identity authority is temporarily unavailable" !== data6) {
28238
+ const err27 = { instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/4/properties/error/const", keyword: "const", params: { allowedValue: "WorkOS identity authority is temporarily unavailable" }, message: "must be equal to constant" };
28238
28239
  if (vErrors === null) {
28239
28240
  vErrors = [err27];
28240
28241
  } else {
@@ -28262,12 +28263,191 @@ function validate43(data, { instancePath = "", parentData, parentDataProperty, r
28262
28263
  props0 = true;
28263
28264
  }
28264
28265
  }
28266
+ const _errs31 = errors;
28267
+ if (errors === _errs31) {
28268
+ if (data && typeof data == "object" && !Array.isArray(data)) {
28269
+ let missing5;
28270
+ if (data.error === void 0 && (missing5 = "error")) {
28271
+ const err29 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/5/required", keyword: "required", params: { missingProperty: missing5 }, message: "must have required property '" + missing5 + "'" };
28272
+ if (vErrors === null) {
28273
+ vErrors = [err29];
28274
+ } else {
28275
+ vErrors.push(err29);
28276
+ }
28277
+ errors++;
28278
+ } else {
28279
+ const _errs33 = errors;
28280
+ for (const key5 in data) {
28281
+ if (!(key5 === "error")) {
28282
+ const err30 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/5/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key5 }, message: "must NOT have additional properties" };
28283
+ if (vErrors === null) {
28284
+ vErrors = [err30];
28285
+ } else {
28286
+ vErrors.push(err30);
28287
+ }
28288
+ errors++;
28289
+ break;
28290
+ }
28291
+ }
28292
+ if (_errs33 === errors) {
28293
+ if (data.error !== void 0) {
28294
+ let data7 = data.error;
28295
+ if (typeof data7 !== "string") {
28296
+ const err31 = { instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/5/properties/error/type", keyword: "type", params: { type: "string" }, message: "must be string" };
28297
+ if (vErrors === null) {
28298
+ vErrors = [err31];
28299
+ } else {
28300
+ vErrors.push(err31);
28301
+ }
28302
+ errors++;
28303
+ }
28304
+ if ("github_install_intent_conflict" !== data7) {
28305
+ const err32 = { instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/5/properties/error/const", keyword: "const", params: { allowedValue: "github_install_intent_conflict" }, message: "must be equal to constant" };
28306
+ if (vErrors === null) {
28307
+ vErrors = [err32];
28308
+ } else {
28309
+ vErrors.push(err32);
28310
+ }
28311
+ errors++;
28312
+ }
28313
+ }
28314
+ }
28315
+ }
28316
+ } else {
28317
+ const err33 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/5/type", keyword: "type", params: { type: "object" }, message: "must be object" };
28318
+ if (vErrors === null) {
28319
+ vErrors = [err33];
28320
+ } else {
28321
+ vErrors.push(err33);
28322
+ }
28323
+ errors++;
28324
+ }
28325
+ }
28326
+ var _valid0 = _errs31 === errors;
28327
+ valid1 = valid1 || _valid0;
28328
+ if (_valid0) {
28329
+ if (props0 !== true) {
28330
+ props0 = true;
28331
+ }
28332
+ }
28333
+ const _errs36 = errors;
28334
+ if (errors === _errs36) {
28335
+ if (data && typeof data == "object" && !Array.isArray(data)) {
28336
+ let missing6;
28337
+ if (data.error === void 0 && (missing6 = "error") || data.retryAt === void 0 && (missing6 = "retryAt")) {
28338
+ const err34 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/6/required", keyword: "required", params: { missingProperty: missing6 }, message: "must have required property '" + missing6 + "'" };
28339
+ if (vErrors === null) {
28340
+ vErrors = [err34];
28341
+ } else {
28342
+ vErrors.push(err34);
28343
+ }
28344
+ errors++;
28345
+ } else {
28346
+ const _errs38 = errors;
28347
+ for (const key6 in data) {
28348
+ if (!(key6 === "error" || key6 === "retryAt")) {
28349
+ const err35 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/6/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key6 }, message: "must NOT have additional properties" };
28350
+ if (vErrors === null) {
28351
+ vErrors = [err35];
28352
+ } else {
28353
+ vErrors.push(err35);
28354
+ }
28355
+ errors++;
28356
+ break;
28357
+ }
28358
+ }
28359
+ if (_errs38 === errors) {
28360
+ if (data.error !== void 0) {
28361
+ let data8 = data.error;
28362
+ const _errs39 = errors;
28363
+ if (typeof data8 !== "string") {
28364
+ const err36 = { instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/6/properties/error/type", keyword: "type", params: { type: "string" }, message: "must be string" };
28365
+ if (vErrors === null) {
28366
+ vErrors = [err36];
28367
+ } else {
28368
+ vErrors.push(err36);
28369
+ }
28370
+ errors++;
28371
+ }
28372
+ if ("github_install_intent_rate_limited" !== data8) {
28373
+ const err37 = { instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/6/properties/error/const", keyword: "const", params: { allowedValue: "github_install_intent_rate_limited" }, message: "must be equal to constant" };
28374
+ if (vErrors === null) {
28375
+ vErrors = [err37];
28376
+ } else {
28377
+ vErrors.push(err37);
28378
+ }
28379
+ errors++;
28380
+ }
28381
+ var valid8 = _errs39 === errors;
28382
+ } else {
28383
+ var valid8 = true;
28384
+ }
28385
+ if (valid8) {
28386
+ if (data.retryAt !== void 0) {
28387
+ let data9 = data.retryAt;
28388
+ const _errs41 = errors;
28389
+ if (!(typeof data9 == "number" && (!(data9 % 1) && !isNaN(data9)) && isFinite(data9))) {
28390
+ const err38 = { instancePath: instancePath + "/retryAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/6/properties/retryAt/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
28391
+ if (vErrors === null) {
28392
+ vErrors = [err38];
28393
+ } else {
28394
+ vErrors.push(err38);
28395
+ }
28396
+ errors++;
28397
+ }
28398
+ if (errors === _errs41) {
28399
+ if (typeof data9 == "number" && isFinite(data9)) {
28400
+ if (data9 > 9007199254740991 || isNaN(data9)) {
28401
+ const err39 = { instancePath: instancePath + "/retryAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/6/properties/retryAt/maximum", keyword: "maximum", params: { comparison: "<=", limit: 9007199254740991 }, message: "must be <= 9007199254740991" };
28402
+ if (vErrors === null) {
28403
+ vErrors = [err39];
28404
+ } else {
28405
+ vErrors.push(err39);
28406
+ }
28407
+ errors++;
28408
+ } else {
28409
+ if (data9 < 0 || isNaN(data9)) {
28410
+ const err40 = { instancePath: instancePath + "/retryAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/6/properties/retryAt/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" };
28411
+ if (vErrors === null) {
28412
+ vErrors = [err40];
28413
+ } else {
28414
+ vErrors.push(err40);
28415
+ }
28416
+ errors++;
28417
+ }
28418
+ }
28419
+ }
28420
+ }
28421
+ var valid8 = _errs41 === errors;
28422
+ } else {
28423
+ var valid8 = true;
28424
+ }
28425
+ }
28426
+ }
28427
+ }
28428
+ } else {
28429
+ const err41 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf/6/type", keyword: "type", params: { type: "object" }, message: "must be object" };
28430
+ if (vErrors === null) {
28431
+ vErrors = [err41];
28432
+ } else {
28433
+ vErrors.push(err41);
28434
+ }
28435
+ errors++;
28436
+ }
28437
+ }
28438
+ var _valid0 = _errs36 === errors;
28439
+ valid1 = valid1 || _valid0;
28440
+ if (_valid0) {
28441
+ if (props0 !== true) {
28442
+ props0 = true;
28443
+ }
28444
+ }
28265
28445
  if (!valid1) {
28266
- const err29 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
28446
+ const err42 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStartErrorResponse/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
28267
28447
  if (vErrors === null) {
28268
- vErrors = [err29];
28448
+ vErrors = [err42];
28269
28449
  } else {
28270
- vErrors.push(err29);
28450
+ vErrors.push(err42);
28271
28451
  }
28272
28452
  errors++;
28273
28453
  validate43.errors = vErrors;
@@ -28644,8 +28824,8 @@ function validate45(data, { instancePath = "", parentData, parentDataProperty, r
28644
28824
  }
28645
28825
  errors++;
28646
28826
  }
28647
- if ("github_install_intent_not_found" !== data2) {
28648
- const err13 = { instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStatusErrorResponse/anyOf/2/properties/error/const", keyword: "const", params: { allowedValue: "github_install_intent_not_found" }, message: "must be equal to constant" };
28827
+ if ("WorkOS identity authority is temporarily unavailable" !== data2) {
28828
+ const err13 = { instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStatusErrorResponse/anyOf/2/properties/error/const", keyword: "const", params: { allowedValue: "WorkOS identity authority is temporarily unavailable" }, message: "must be equal to constant" };
28649
28829
  if (vErrors === null) {
28650
28830
  vErrors = [err13];
28651
28831
  } else {
@@ -28673,12 +28853,79 @@ function validate45(data, { instancePath = "", parentData, parentDataProperty, r
28673
28853
  props0 = true;
28674
28854
  }
28675
28855
  }
28856
+ const _errs17 = errors;
28857
+ if (errors === _errs17) {
28858
+ if (data && typeof data == "object" && !Array.isArray(data)) {
28859
+ let missing3;
28860
+ if (data.error === void 0 && (missing3 = "error")) {
28861
+ const err15 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStatusErrorResponse/anyOf/3/required", keyword: "required", params: { missingProperty: missing3 }, message: "must have required property '" + missing3 + "'" };
28862
+ if (vErrors === null) {
28863
+ vErrors = [err15];
28864
+ } else {
28865
+ vErrors.push(err15);
28866
+ }
28867
+ errors++;
28868
+ } else {
28869
+ const _errs19 = errors;
28870
+ for (const key3 in data) {
28871
+ if (!(key3 === "error")) {
28872
+ const err16 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStatusErrorResponse/anyOf/3/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key3 }, message: "must NOT have additional properties" };
28873
+ if (vErrors === null) {
28874
+ vErrors = [err16];
28875
+ } else {
28876
+ vErrors.push(err16);
28877
+ }
28878
+ errors++;
28879
+ break;
28880
+ }
28881
+ }
28882
+ if (_errs19 === errors) {
28883
+ if (data.error !== void 0) {
28884
+ let data3 = data.error;
28885
+ if (typeof data3 !== "string") {
28886
+ const err17 = { instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStatusErrorResponse/anyOf/3/properties/error/type", keyword: "type", params: { type: "string" }, message: "must be string" };
28887
+ if (vErrors === null) {
28888
+ vErrors = [err17];
28889
+ } else {
28890
+ vErrors.push(err17);
28891
+ }
28892
+ errors++;
28893
+ }
28894
+ if ("github_install_intent_not_found" !== data3) {
28895
+ const err18 = { instancePath: instancePath + "/error", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStatusErrorResponse/anyOf/3/properties/error/const", keyword: "const", params: { allowedValue: "github_install_intent_not_found" }, message: "must be equal to constant" };
28896
+ if (vErrors === null) {
28897
+ vErrors = [err18];
28898
+ } else {
28899
+ vErrors.push(err18);
28900
+ }
28901
+ errors++;
28902
+ }
28903
+ }
28904
+ }
28905
+ }
28906
+ } else {
28907
+ const err19 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStatusErrorResponse/anyOf/3/type", keyword: "type", params: { type: "object" }, message: "must be object" };
28908
+ if (vErrors === null) {
28909
+ vErrors = [err19];
28910
+ } else {
28911
+ vErrors.push(err19);
28912
+ }
28913
+ errors++;
28914
+ }
28915
+ }
28916
+ var _valid0 = _errs17 === errors;
28917
+ valid1 = valid1 || _valid0;
28918
+ if (_valid0) {
28919
+ if (props0 !== true) {
28920
+ props0 = true;
28921
+ }
28922
+ }
28676
28923
  if (!valid1) {
28677
- const err15 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStatusErrorResponse/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
28924
+ const err20 = { instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStatusErrorResponse/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
28678
28925
  if (vErrors === null) {
28679
- vErrors = [err15];
28926
+ vErrors = [err20];
28680
28927
  } else {
28681
- vErrors.push(err15);
28928
+ vErrors.push(err20);
28682
28929
  }
28683
28930
  errors++;
28684
28931
  validate45.errors = vErrors;
@@ -28753,7 +29000,7 @@ function validate46(data, { instancePath = "", parentData, parentDataProperty, r
28753
29000
  }
28754
29001
  validate46.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
28755
29002
  var isGitHubInstallIntentStatusResponseStructure = validate47;
28756
- var schema85 = { "anyOf": [{ "type": "object", "properties": { "protocolVersion": { "type": "number", "const": 1 }, "mode": { "type": "string", "const": "install_intent_v1" }, "found": { "type": "boolean", "const": true }, "expiresAt": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "status": { "type": "string", "const": "pending" } }, "required": ["protocolVersion", "mode", "found", "expiresAt", "status"], "additionalProperties": false }, { "type": "object", "properties": { "protocolVersion": { "type": "number", "const": 1 }, "mode": { "type": "string", "const": "install_intent_v1" }, "found": { "type": "boolean", "const": true }, "expiresAt": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "status": { "type": "string", "const": "claimed" }, "leaseExpiresAt": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "required": ["protocolVersion", "mode", "found", "expiresAt", "status", "leaseExpiresAt"], "additionalProperties": false, "x-primitive-runtime-refinements": ["claim_lease_within_intent_ttl"] }, { "type": "object", "properties": { "protocolVersion": { "type": "number", "const": 1 }, "mode": { "type": "string", "const": "install_intent_v1" }, "found": { "type": "boolean", "const": true }, "expiresAt": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "status": { "type": "string", "const": "consumed" }, "completedAt": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "repositoryCount": { "type": "integer", "minimum": 1, "maximum": 256 }, "adminRepositoryCount": { "type": "integer", "minimum": 1, "maximum": 128 }, "nonAdminRepositoryCount": { "type": "integer", "minimum": 0, "maximum": 256 } }, "required": ["protocolVersion", "mode", "found", "expiresAt", "status", "completedAt", "repositoryCount", "adminRepositoryCount", "nonAdminRepositoryCount"], "additionalProperties": false, "x-primitive-runtime-refinements": ["repository_count_partition", "completion_within_intent_ttl"] }, { "type": "object", "properties": { "protocolVersion": { "type": "number", "const": 1 }, "mode": { "type": "string", "const": "install_intent_v1" }, "found": { "type": "boolean", "const": true }, "expiresAt": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "status": { "type": "string", "const": "expired" }, "closedAt": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "required": ["protocolVersion", "mode", "found", "expiresAt", "status", "closedAt"], "additionalProperties": false, "x-primitive-runtime-refinements": ["expiry_not_before_intent_ttl"] }, { "type": "object", "properties": { "protocolVersion": { "type": "number", "const": 1 }, "mode": { "type": "string", "const": "install_intent_v1" }, "found": { "type": "boolean", "const": true }, "expiresAt": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "status": { "type": "string", "const": "cancelled" }, "closedAt": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "required": ["protocolVersion", "mode", "found", "expiresAt", "status", "closedAt"], "additionalProperties": false, "x-primitive-runtime-refinements": ["cancellation_within_intent_ttl"] }, { "type": "object", "properties": { "protocolVersion": { "type": "number", "const": 1 }, "mode": { "type": "string", "const": "install_intent_v1" }, "found": { "type": "boolean", "const": true }, "expiresAt": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "status": { "type": "string", "const": "failed_terminal" }, "closedAt": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "failureCode": { "type": "string", "enum": ["claim_lease_expired", "authority_changed", "oauth_exchange_failed", "installation_not_administered", "repository_enumeration_failed", "repository_bound_exceeded", "installation_changed", "proof_commit_failed"] } }, "required": ["protocolVersion", "mode", "found", "expiresAt", "status", "closedAt", "failureCode"], "additionalProperties": false, "x-primitive-runtime-refinements": ["terminal_failure_within_intent_ttl_except_claim_lease_expired"] }] };
29003
+ var schema85 = { "anyOf": [{ "type": "object", "properties": { "protocolVersion": { "type": "number", "const": 1 }, "mode": { "type": "string", "const": "install_intent_v1" }, "found": { "type": "boolean", "const": true }, "expiresAt": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "status": { "type": "string", "const": "pending" } }, "required": ["protocolVersion", "mode", "found", "expiresAt", "status"], "additionalProperties": false }, { "type": "object", "properties": { "protocolVersion": { "type": "number", "const": 1 }, "mode": { "type": "string", "const": "install_intent_v1" }, "found": { "type": "boolean", "const": true }, "expiresAt": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "status": { "type": "string", "const": "claimed" }, "leaseExpiresAt": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "required": ["protocolVersion", "mode", "found", "expiresAt", "status", "leaseExpiresAt"], "additionalProperties": false, "x-primitive-runtime-refinements": ["claim_lease_within_intent_ttl"] }, { "type": "object", "properties": { "protocolVersion": { "type": "number", "const": 1 }, "mode": { "type": "string", "const": "install_intent_v1" }, "found": { "type": "boolean", "const": true }, "expiresAt": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "status": { "type": "string", "const": "consumed" }, "completedAt": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "repositoryCount": { "type": "integer", "minimum": 1, "maximum": 256 }, "adminRepositoryCount": { "type": "integer", "minimum": 1, "maximum": 128 }, "nonAdminRepositoryCount": { "type": "integer", "minimum": 0, "maximum": 256 } }, "required": ["protocolVersion", "mode", "found", "expiresAt", "status", "completedAt", "repositoryCount", "adminRepositoryCount", "nonAdminRepositoryCount"], "additionalProperties": false, "x-primitive-runtime-refinements": ["repository_count_partition", "completion_within_intent_ttl"] }, { "type": "object", "properties": { "protocolVersion": { "type": "number", "const": 1 }, "mode": { "type": "string", "const": "install_intent_v1" }, "found": { "type": "boolean", "const": true }, "expiresAt": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "status": { "type": "string", "const": "expired" }, "closedAt": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "required": ["protocolVersion", "mode", "found", "expiresAt", "status", "closedAt"], "additionalProperties": false, "x-primitive-runtime-refinements": ["expiry_not_before_intent_ttl"] }, { "type": "object", "properties": { "protocolVersion": { "type": "number", "const": 1 }, "mode": { "type": "string", "const": "install_intent_v1" }, "found": { "type": "boolean", "const": true }, "expiresAt": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "status": { "type": "string", "const": "cancelled" }, "closedAt": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 } }, "required": ["protocolVersion", "mode", "found", "expiresAt", "status", "closedAt"], "additionalProperties": false, "x-primitive-runtime-refinements": ["cancellation_within_intent_ttl"] }, { "type": "object", "properties": { "protocolVersion": { "type": "number", "const": 1 }, "mode": { "type": "string", "const": "install_intent_v1" }, "found": { "type": "boolean", "const": true }, "expiresAt": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "status": { "type": "string", "const": "failed_terminal" }, "closedAt": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }, "failureCode": { "type": "string", "enum": ["claim_lease_expired", "authority_changed", "oauth_exchange_failed", "installation_not_administered", "repository_enumeration_failed", "repository_bound_exceeded", "installation_changed", "repository_identity_migration_required", "proof_commit_failed"] } }, "required": ["protocolVersion", "mode", "found", "expiresAt", "status", "closedAt", "failureCode"], "additionalProperties": false, "x-primitive-runtime-refinements": ["terminal_failure_within_intent_ttl_except_claim_lease_expired"] }] };
28757
29004
  var func32 = Object.prototype.hasOwnProperty;
28758
29005
  function validate47(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
28759
29006
  ;
@@ -30241,7 +30488,7 @@ function validate47(data, { instancePath = "", parentData, parentDataProperty, r
30241
30488
  }
30242
30489
  errors++;
30243
30490
  }
30244
- if (!(data38 === "claim_lease_expired" || data38 === "authority_changed" || data38 === "oauth_exchange_failed" || data38 === "installation_not_administered" || data38 === "repository_enumeration_failed" || data38 === "repository_bound_exceeded" || data38 === "installation_changed" || data38 === "proof_commit_failed")) {
30491
+ if (!(data38 === "claim_lease_expired" || data38 === "authority_changed" || data38 === "oauth_exchange_failed" || data38 === "installation_not_administered" || data38 === "repository_enumeration_failed" || data38 === "repository_bound_exceeded" || data38 === "installation_changed" || data38 === "repository_identity_migration_required" || data38 === "proof_commit_failed")) {
30245
30492
  const err108 = { instancePath: instancePath + "/failureCode", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/GitHubInstallIntentStatusResponse/anyOf/5/properties/failureCode/enum", keyword: "enum", params: { allowedValues: schema85.anyOf[5].properties.failureCode.enum }, message: "must be equal to one of the allowed values" };
30246
30493
  if (vErrors === null) {
30247
30494
  vErrors = [err108];
@@ -32147,67 +32394,1804 @@ function validate54(data, { instancePath = "", parentData, parentDataProperty, r
32147
32394
  return errors === 0;
32148
32395
  }
32149
32396
  validate54.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
32150
-
32151
- // src/contract/cli-http-v1.ts
32152
- function isGitHubInstallIntentStatusResponse(value) {
32153
- if (!isGitHubInstallIntentStatusResponseStructure(value)) {
32154
- return false;
32397
+ var pattern17 = new RegExp("^[a-f0-9]{64}$", "u");
32398
+ var pattern18 = new RegExp("^api_key_[A-Za-z0-9_-]+$", "u");
32399
+ function validate55(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
32400
+ ;
32401
+ let vErrors = null;
32402
+ let errors = 0;
32403
+ const evaluated0 = validate55.evaluated;
32404
+ if (evaluated0.dynamicProps) {
32405
+ evaluated0.props = void 0;
32155
32406
  }
32156
- switch (value.status) {
32157
- case "claimed":
32158
- return value.leaseExpiresAt <= value.expiresAt;
32159
- case "consumed":
32160
- return value.repositoryCount === value.adminRepositoryCount + value.nonAdminRepositoryCount && value.completedAt <= value.expiresAt;
32161
- case "expired":
32162
- return value.closedAt >= value.expiresAt;
32163
- case "cancelled":
32164
- return value.closedAt <= value.expiresAt;
32165
- case "failed_terminal":
32166
- return value.failureCode === "claim_lease_expired" || value.closedAt <= value.expiresAt;
32167
- case "pending":
32168
- return true;
32407
+ if (evaluated0.dynamicItems) {
32408
+ evaluated0.items = void 0;
32409
+ }
32410
+ const _errs0 = errors;
32411
+ if (errors === _errs0) {
32412
+ if (data && typeof data == "object" && !Array.isArray(data)) {
32413
+ let missing0;
32414
+ if (data.requestId === void 0 && (missing0 = "requestId") || data.limit === void 0 && (missing0 = "limit")) {
32415
+ validate55.errors = [{ instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListRequest/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
32416
+ return false;
32417
+ } else {
32418
+ const _errs2 = errors;
32419
+ for (const key0 in data) {
32420
+ if (!(key0 === "requestId" || key0 === "limit" || key0 === "after")) {
32421
+ validate55.errors = [{ instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListRequest/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }];
32422
+ return false;
32423
+ break;
32424
+ }
32425
+ }
32426
+ if (_errs2 === errors) {
32427
+ if (data.requestId !== void 0) {
32428
+ let data0 = data.requestId;
32429
+ const _errs3 = errors;
32430
+ if (errors === _errs3) {
32431
+ if (typeof data0 === "string") {
32432
+ if (!pattern17.test(data0)) {
32433
+ validate55.errors = [{ instancePath: instancePath + "/requestId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListRequest/properties/requestId/pattern", keyword: "pattern", params: { pattern: "^[a-f0-9]{64}$" }, message: 'must match pattern "^[a-f0-9]{64}$"' }];
32434
+ return false;
32435
+ }
32436
+ } else {
32437
+ validate55.errors = [{ instancePath: instancePath + "/requestId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListRequest/properties/requestId/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
32438
+ return false;
32439
+ }
32440
+ }
32441
+ var valid1 = _errs3 === errors;
32442
+ } else {
32443
+ var valid1 = true;
32444
+ }
32445
+ if (valid1) {
32446
+ if (data.limit !== void 0) {
32447
+ let data1 = data.limit;
32448
+ const _errs5 = errors;
32449
+ if (!(typeof data1 == "number" && (!(data1 % 1) && !isNaN(data1)) && isFinite(data1))) {
32450
+ validate55.errors = [{ instancePath: instancePath + "/limit", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListRequest/properties/limit/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
32451
+ return false;
32452
+ }
32453
+ if (errors === _errs5) {
32454
+ if (typeof data1 == "number" && isFinite(data1)) {
32455
+ if (data1 > 100 || isNaN(data1)) {
32456
+ validate55.errors = [{ instancePath: instancePath + "/limit", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListRequest/properties/limit/maximum", keyword: "maximum", params: { comparison: "<=", limit: 100 }, message: "must be <= 100" }];
32457
+ return false;
32458
+ } else {
32459
+ if (data1 < 1 || isNaN(data1)) {
32460
+ validate55.errors = [{ instancePath: instancePath + "/limit", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListRequest/properties/limit/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1" }];
32461
+ return false;
32462
+ }
32463
+ }
32464
+ }
32465
+ }
32466
+ var valid1 = _errs5 === errors;
32467
+ } else {
32468
+ var valid1 = true;
32469
+ }
32470
+ if (valid1) {
32471
+ if (data.after !== void 0) {
32472
+ let data2 = data.after;
32473
+ const _errs7 = errors;
32474
+ if (errors === _errs7) {
32475
+ if (typeof data2 === "string") {
32476
+ if (func1(data2) > 256) {
32477
+ validate55.errors = [{ instancePath: instancePath + "/after", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListRequest/properties/after/maxLength", keyword: "maxLength", params: { limit: 256 }, message: "must NOT have more than 256 characters" }];
32478
+ return false;
32479
+ } else {
32480
+ if (func1(data2) < 9) {
32481
+ validate55.errors = [{ instancePath: instancePath + "/after", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListRequest/properties/after/minLength", keyword: "minLength", params: { limit: 9 }, message: "must NOT have fewer than 9 characters" }];
32482
+ return false;
32483
+ } else {
32484
+ if (!pattern18.test(data2)) {
32485
+ validate55.errors = [{ instancePath: instancePath + "/after", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListRequest/properties/after/pattern", keyword: "pattern", params: { pattern: "^api_key_[A-Za-z0-9_-]+$" }, message: 'must match pattern "^api_key_[A-Za-z0-9_-]+$"' }];
32486
+ return false;
32487
+ }
32488
+ }
32489
+ }
32490
+ } else {
32491
+ validate55.errors = [{ instancePath: instancePath + "/after", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListRequest/properties/after/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
32492
+ return false;
32493
+ }
32494
+ }
32495
+ var valid1 = _errs7 === errors;
32496
+ } else {
32497
+ var valid1 = true;
32498
+ }
32499
+ }
32500
+ }
32501
+ }
32502
+ }
32503
+ } else {
32504
+ validate55.errors = [{ instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListRequest/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
32505
+ return false;
32506
+ }
32169
32507
  }
32508
+ validate55.errors = vErrors;
32509
+ return errors === 0;
32170
32510
  }
32171
-
32172
- // src/lib/github-install-intent.ts
32173
- var PROTOCOL_VERSION = 1;
32174
- var MODE = "install_intent_v1";
32511
+ validate55.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
32512
+ var pattern20 = new RegExp("^[\\x21-\\x7e](?:[\\x20-\\x7e]{0,126}[\\x21-\\x7e])?$", "u");
32513
+ var pattern21 = new RegExp("^[^\\u0000-\\u001f\\u007f-\\u009f\\u2028\\u2029\\u061c\\u200b-\\u200f\\u202a-\\u202e\\u2060\\u2066-\\u2069\\ufeff]+$", "u");
32514
+ var pattern22 = new RegExp("^[\\x21-\\x7e]+$", "u");
32515
+ function validate56(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
32516
+ ;
32517
+ let vErrors = null;
32518
+ let errors = 0;
32519
+ const evaluated0 = validate56.evaluated;
32520
+ if (evaluated0.dynamicProps) {
32521
+ evaluated0.props = void 0;
32522
+ }
32523
+ if (evaluated0.dynamicItems) {
32524
+ evaluated0.items = void 0;
32525
+ }
32526
+ const _errs0 = errors;
32527
+ if (errors === _errs0) {
32528
+ if (data && typeof data == "object" && !Array.isArray(data)) {
32529
+ let missing0;
32530
+ if (data.apiKeys === void 0 && (missing0 = "apiKeys") || data.nextCursor === void 0 && (missing0 = "nextCursor")) {
32531
+ validate56.errors = [{ instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
32532
+ return false;
32533
+ } else {
32534
+ const _errs2 = errors;
32535
+ for (const key0 in data) {
32536
+ if (!(key0 === "apiKeys" || key0 === "nextCursor")) {
32537
+ validate56.errors = [{ instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }];
32538
+ return false;
32539
+ break;
32540
+ }
32541
+ }
32542
+ if (_errs2 === errors) {
32543
+ if (data.apiKeys !== void 0) {
32544
+ let data0 = data.apiKeys;
32545
+ const _errs3 = errors;
32546
+ if (errors === _errs3) {
32547
+ if (Array.isArray(data0)) {
32548
+ if (data0.length > 100) {
32549
+ validate56.errors = [{ instancePath: instancePath + "/apiKeys", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/maxItems", keyword: "maxItems", params: { limit: 100 }, message: "must NOT have more than 100 items" }];
32550
+ return false;
32551
+ } else {
32552
+ var valid2 = true;
32553
+ const len0 = data0.length;
32554
+ for (let i0 = 0; i0 < len0; i0++) {
32555
+ let data1 = data0[i0];
32556
+ const _errs5 = errors;
32557
+ if (errors === _errs5) {
32558
+ if (data1 && typeof data1 == "object" && !Array.isArray(data1)) {
32559
+ let missing1;
32560
+ if (data1.id === void 0 && (missing1 = "id") || data1.name === void 0 && (missing1 = "name") || data1.obfuscatedValue === void 0 && (missing1 = "obfuscatedValue") || data1.permissions === void 0 && (missing1 = "permissions") || data1.lastUsedAt === void 0 && (missing1 = "lastUsedAt") || data1.expiresAt === void 0 && (missing1 = "expiresAt") || data1.createdAt === void 0 && (missing1 = "createdAt") || data1.updatedAt === void 0 && (missing1 = "updatedAt")) {
32561
+ validate56.errors = [{ instancePath: instancePath + "/apiKeys/" + i0, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" }];
32562
+ return false;
32563
+ } else {
32564
+ const _errs7 = errors;
32565
+ for (const key1 in data1) {
32566
+ if (!(key1 === "id" || key1 === "name" || key1 === "obfuscatedValue" || key1 === "permissions" || key1 === "lastUsedAt" || key1 === "expiresAt" || key1 === "createdAt" || key1 === "updatedAt")) {
32567
+ validate56.errors = [{ instancePath: instancePath + "/apiKeys/" + i0, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key1 }, message: "must NOT have additional properties" }];
32568
+ return false;
32569
+ break;
32570
+ }
32571
+ }
32572
+ if (_errs7 === errors) {
32573
+ if (data1.id !== void 0) {
32574
+ let data2 = data1.id;
32575
+ const _errs8 = errors;
32576
+ if (errors === _errs8) {
32577
+ if (typeof data2 === "string") {
32578
+ if (func1(data2) > 256) {
32579
+ validate56.errors = [{ instancePath: instancePath + "/apiKeys/" + i0 + "/id", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/id/maxLength", keyword: "maxLength", params: { limit: 256 }, message: "must NOT have more than 256 characters" }];
32580
+ return false;
32581
+ } else {
32582
+ if (func1(data2) < 9) {
32583
+ validate56.errors = [{ instancePath: instancePath + "/apiKeys/" + i0 + "/id", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/id/minLength", keyword: "minLength", params: { limit: 9 }, message: "must NOT have fewer than 9 characters" }];
32584
+ return false;
32585
+ } else {
32586
+ if (!pattern18.test(data2)) {
32587
+ validate56.errors = [{ instancePath: instancePath + "/apiKeys/" + i0 + "/id", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/id/pattern", keyword: "pattern", params: { pattern: "^api_key_[A-Za-z0-9_-]+$" }, message: 'must match pattern "^api_key_[A-Za-z0-9_-]+$"' }];
32588
+ return false;
32589
+ }
32590
+ }
32591
+ }
32592
+ } else {
32593
+ validate56.errors = [{ instancePath: instancePath + "/apiKeys/" + i0 + "/id", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/id/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
32594
+ return false;
32595
+ }
32596
+ }
32597
+ var valid3 = _errs8 === errors;
32598
+ } else {
32599
+ var valid3 = true;
32600
+ }
32601
+ if (valid3) {
32602
+ if (data1.name !== void 0) {
32603
+ let data3 = data1.name;
32604
+ const _errs10 = errors;
32605
+ if (errors === _errs10) {
32606
+ if (typeof data3 === "string") {
32607
+ if (func1(data3) > 128) {
32608
+ validate56.errors = [{ instancePath: instancePath + "/apiKeys/" + i0 + "/name", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/name/maxLength", keyword: "maxLength", params: { limit: 128 }, message: "must NOT have more than 128 characters" }];
32609
+ return false;
32610
+ } else {
32611
+ if (func1(data3) < 1) {
32612
+ validate56.errors = [{ instancePath: instancePath + "/apiKeys/" + i0 + "/name", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/name/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" }];
32613
+ return false;
32614
+ } else {
32615
+ if (!pattern20.test(data3)) {
32616
+ validate56.errors = [{ instancePath: instancePath + "/apiKeys/" + i0 + "/name", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/name/pattern", keyword: "pattern", params: { pattern: "^[\\x21-\\x7e](?:[\\x20-\\x7e]{0,126}[\\x21-\\x7e])?$" }, message: 'must match pattern "^[\\x21-\\x7e](?:[\\x20-\\x7e]{0,126}[\\x21-\\x7e])?$"' }];
32617
+ return false;
32618
+ }
32619
+ }
32620
+ }
32621
+ } else {
32622
+ validate56.errors = [{ instancePath: instancePath + "/apiKeys/" + i0 + "/name", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/name/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
32623
+ return false;
32624
+ }
32625
+ }
32626
+ var valid3 = _errs10 === errors;
32627
+ } else {
32628
+ var valid3 = true;
32629
+ }
32630
+ if (valid3) {
32631
+ if (data1.obfuscatedValue !== void 0) {
32632
+ let data4 = data1.obfuscatedValue;
32633
+ const _errs12 = errors;
32634
+ if (errors === _errs12) {
32635
+ if (typeof data4 === "string") {
32636
+ if (func1(data4) > 256) {
32637
+ validate56.errors = [{ instancePath: instancePath + "/apiKeys/" + i0 + "/obfuscatedValue", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/obfuscatedValue/maxLength", keyword: "maxLength", params: { limit: 256 }, message: "must NOT have more than 256 characters" }];
32638
+ return false;
32639
+ } else {
32640
+ if (func1(data4) < 1) {
32641
+ validate56.errors = [{ instancePath: instancePath + "/apiKeys/" + i0 + "/obfuscatedValue", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/obfuscatedValue/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" }];
32642
+ return false;
32643
+ } else {
32644
+ if (!pattern21.test(data4)) {
32645
+ validate56.errors = [{ instancePath: instancePath + "/apiKeys/" + i0 + "/obfuscatedValue", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/obfuscatedValue/pattern", keyword: "pattern", params: { pattern: "^[^\\u0000-\\u001f\\u007f-\\u009f\\u2028\\u2029\\u061c\\u200b-\\u200f\\u202a-\\u202e\\u2060\\u2066-\\u2069\\ufeff]+$" }, message: 'must match pattern "^[^\\u0000-\\u001f\\u007f-\\u009f\\u2028\\u2029\\u061c\\u200b-\\u200f\\u202a-\\u202e\\u2060\\u2066-\\u2069\\ufeff]+$"' }];
32646
+ return false;
32647
+ }
32648
+ }
32649
+ }
32650
+ } else {
32651
+ validate56.errors = [{ instancePath: instancePath + "/apiKeys/" + i0 + "/obfuscatedValue", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/obfuscatedValue/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
32652
+ return false;
32653
+ }
32654
+ }
32655
+ var valid3 = _errs12 === errors;
32656
+ } else {
32657
+ var valid3 = true;
32658
+ }
32659
+ if (valid3) {
32660
+ if (data1.permissions !== void 0) {
32661
+ let data5 = data1.permissions;
32662
+ const _errs14 = errors;
32663
+ if (errors === _errs14) {
32664
+ if (Array.isArray(data5)) {
32665
+ if (data5.length > 100) {
32666
+ validate56.errors = [{ instancePath: instancePath + "/apiKeys/" + i0 + "/permissions", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/permissions/maxItems", keyword: "maxItems", params: { limit: 100 }, message: "must NOT have more than 100 items" }];
32667
+ return false;
32668
+ } else {
32669
+ var valid4 = true;
32670
+ const len1 = data5.length;
32671
+ for (let i1 = 0; i1 < len1; i1++) {
32672
+ let data6 = data5[i1];
32673
+ const _errs16 = errors;
32674
+ if (errors === _errs16) {
32675
+ if (typeof data6 === "string") {
32676
+ if (func1(data6) > 128) {
32677
+ validate56.errors = [{ instancePath: instancePath + "/apiKeys/" + i0 + "/permissions/" + i1, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/permissions/items/maxLength", keyword: "maxLength", params: { limit: 128 }, message: "must NOT have more than 128 characters" }];
32678
+ return false;
32679
+ } else {
32680
+ if (func1(data6) < 1) {
32681
+ validate56.errors = [{ instancePath: instancePath + "/apiKeys/" + i0 + "/permissions/" + i1, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/permissions/items/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" }];
32682
+ return false;
32683
+ } else {
32684
+ if (!pattern22.test(data6)) {
32685
+ validate56.errors = [{ instancePath: instancePath + "/apiKeys/" + i0 + "/permissions/" + i1, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/permissions/items/pattern", keyword: "pattern", params: { pattern: "^[\\x21-\\x7e]+$" }, message: 'must match pattern "^[\\x21-\\x7e]+$"' }];
32686
+ return false;
32687
+ }
32688
+ }
32689
+ }
32690
+ } else {
32691
+ validate56.errors = [{ instancePath: instancePath + "/apiKeys/" + i0 + "/permissions/" + i1, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/permissions/items/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
32692
+ return false;
32693
+ }
32694
+ }
32695
+ var valid4 = _errs16 === errors;
32696
+ if (!valid4) {
32697
+ break;
32698
+ }
32699
+ }
32700
+ }
32701
+ } else {
32702
+ validate56.errors = [{ instancePath: instancePath + "/apiKeys/" + i0 + "/permissions", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/permissions/type", keyword: "type", params: { type: "array" }, message: "must be array" }];
32703
+ return false;
32704
+ }
32705
+ }
32706
+ var valid3 = _errs14 === errors;
32707
+ } else {
32708
+ var valid3 = true;
32709
+ }
32710
+ if (valid3) {
32711
+ if (data1.lastUsedAt !== void 0) {
32712
+ let data7 = data1.lastUsedAt;
32713
+ const _errs18 = errors;
32714
+ const _errs19 = errors;
32715
+ let valid5 = false;
32716
+ const _errs20 = errors;
32717
+ if (!(typeof data7 == "number" && (!(data7 % 1) && !isNaN(data7)) && isFinite(data7))) {
32718
+ const err0 = { instancePath: instancePath + "/apiKeys/" + i0 + "/lastUsedAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/lastUsedAt/anyOf/0/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
32719
+ if (vErrors === null) {
32720
+ vErrors = [err0];
32721
+ } else {
32722
+ vErrors.push(err0);
32723
+ }
32724
+ errors++;
32725
+ }
32726
+ if (errors === _errs20) {
32727
+ if (typeof data7 == "number" && isFinite(data7)) {
32728
+ if (data7 > 9007199254740991 || isNaN(data7)) {
32729
+ const err1 = { instancePath: instancePath + "/apiKeys/" + i0 + "/lastUsedAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/lastUsedAt/anyOf/0/maximum", keyword: "maximum", params: { comparison: "<=", limit: 9007199254740991 }, message: "must be <= 9007199254740991" };
32730
+ if (vErrors === null) {
32731
+ vErrors = [err1];
32732
+ } else {
32733
+ vErrors.push(err1);
32734
+ }
32735
+ errors++;
32736
+ } else {
32737
+ if (data7 < 0 || isNaN(data7)) {
32738
+ const err2 = { instancePath: instancePath + "/apiKeys/" + i0 + "/lastUsedAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/lastUsedAt/anyOf/0/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" };
32739
+ if (vErrors === null) {
32740
+ vErrors = [err2];
32741
+ } else {
32742
+ vErrors.push(err2);
32743
+ }
32744
+ errors++;
32745
+ }
32746
+ }
32747
+ }
32748
+ }
32749
+ var _valid0 = _errs20 === errors;
32750
+ valid5 = valid5 || _valid0;
32751
+ const _errs22 = errors;
32752
+ if (data7 !== null) {
32753
+ const err3 = { instancePath: instancePath + "/apiKeys/" + i0 + "/lastUsedAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/lastUsedAt/anyOf/1/type", keyword: "type", params: { type: "null" }, message: "must be null" };
32754
+ if (vErrors === null) {
32755
+ vErrors = [err3];
32756
+ } else {
32757
+ vErrors.push(err3);
32758
+ }
32759
+ errors++;
32760
+ }
32761
+ var _valid0 = _errs22 === errors;
32762
+ valid5 = valid5 || _valid0;
32763
+ if (!valid5) {
32764
+ const err4 = { instancePath: instancePath + "/apiKeys/" + i0 + "/lastUsedAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/lastUsedAt/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
32765
+ if (vErrors === null) {
32766
+ vErrors = [err4];
32767
+ } else {
32768
+ vErrors.push(err4);
32769
+ }
32770
+ errors++;
32771
+ validate56.errors = vErrors;
32772
+ return false;
32773
+ } else {
32774
+ errors = _errs19;
32775
+ if (vErrors !== null) {
32776
+ if (_errs19) {
32777
+ vErrors.length = _errs19;
32778
+ } else {
32779
+ vErrors = null;
32780
+ }
32781
+ }
32782
+ }
32783
+ var valid3 = _errs18 === errors;
32784
+ } else {
32785
+ var valid3 = true;
32786
+ }
32787
+ if (valid3) {
32788
+ if (data1.expiresAt !== void 0) {
32789
+ let data8 = data1.expiresAt;
32790
+ const _errs24 = errors;
32791
+ const _errs25 = errors;
32792
+ let valid6 = false;
32793
+ const _errs26 = errors;
32794
+ if (!(typeof data8 == "number" && (!(data8 % 1) && !isNaN(data8)) && isFinite(data8))) {
32795
+ const err5 = { instancePath: instancePath + "/apiKeys/" + i0 + "/expiresAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/expiresAt/anyOf/0/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
32796
+ if (vErrors === null) {
32797
+ vErrors = [err5];
32798
+ } else {
32799
+ vErrors.push(err5);
32800
+ }
32801
+ errors++;
32802
+ }
32803
+ if (errors === _errs26) {
32804
+ if (typeof data8 == "number" && isFinite(data8)) {
32805
+ if (data8 > 9007199254740991 || isNaN(data8)) {
32806
+ const err6 = { instancePath: instancePath + "/apiKeys/" + i0 + "/expiresAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/expiresAt/anyOf/0/maximum", keyword: "maximum", params: { comparison: "<=", limit: 9007199254740991 }, message: "must be <= 9007199254740991" };
32807
+ if (vErrors === null) {
32808
+ vErrors = [err6];
32809
+ } else {
32810
+ vErrors.push(err6);
32811
+ }
32812
+ errors++;
32813
+ } else {
32814
+ if (data8 < 0 || isNaN(data8)) {
32815
+ const err7 = { instancePath: instancePath + "/apiKeys/" + i0 + "/expiresAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/expiresAt/anyOf/0/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" };
32816
+ if (vErrors === null) {
32817
+ vErrors = [err7];
32818
+ } else {
32819
+ vErrors.push(err7);
32820
+ }
32821
+ errors++;
32822
+ }
32823
+ }
32824
+ }
32825
+ }
32826
+ var _valid1 = _errs26 === errors;
32827
+ valid6 = valid6 || _valid1;
32828
+ const _errs28 = errors;
32829
+ if (data8 !== null) {
32830
+ const err8 = { instancePath: instancePath + "/apiKeys/" + i0 + "/expiresAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/expiresAt/anyOf/1/type", keyword: "type", params: { type: "null" }, message: "must be null" };
32831
+ if (vErrors === null) {
32832
+ vErrors = [err8];
32833
+ } else {
32834
+ vErrors.push(err8);
32835
+ }
32836
+ errors++;
32837
+ }
32838
+ var _valid1 = _errs28 === errors;
32839
+ valid6 = valid6 || _valid1;
32840
+ if (!valid6) {
32841
+ const err9 = { instancePath: instancePath + "/apiKeys/" + i0 + "/expiresAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/expiresAt/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
32842
+ if (vErrors === null) {
32843
+ vErrors = [err9];
32844
+ } else {
32845
+ vErrors.push(err9);
32846
+ }
32847
+ errors++;
32848
+ validate56.errors = vErrors;
32849
+ return false;
32850
+ } else {
32851
+ errors = _errs25;
32852
+ if (vErrors !== null) {
32853
+ if (_errs25) {
32854
+ vErrors.length = _errs25;
32855
+ } else {
32856
+ vErrors = null;
32857
+ }
32858
+ }
32859
+ }
32860
+ var valid3 = _errs24 === errors;
32861
+ } else {
32862
+ var valid3 = true;
32863
+ }
32864
+ if (valid3) {
32865
+ if (data1.createdAt !== void 0) {
32866
+ let data9 = data1.createdAt;
32867
+ const _errs30 = errors;
32868
+ if (!(typeof data9 == "number" && (!(data9 % 1) && !isNaN(data9)) && isFinite(data9))) {
32869
+ validate56.errors = [{ instancePath: instancePath + "/apiKeys/" + i0 + "/createdAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/createdAt/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
32870
+ return false;
32871
+ }
32872
+ if (errors === _errs30) {
32873
+ if (typeof data9 == "number" && isFinite(data9)) {
32874
+ if (data9 > 9007199254740991 || isNaN(data9)) {
32875
+ validate56.errors = [{ instancePath: instancePath + "/apiKeys/" + i0 + "/createdAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/createdAt/maximum", keyword: "maximum", params: { comparison: "<=", limit: 9007199254740991 }, message: "must be <= 9007199254740991" }];
32876
+ return false;
32877
+ } else {
32878
+ if (data9 < 0 || isNaN(data9)) {
32879
+ validate56.errors = [{ instancePath: instancePath + "/apiKeys/" + i0 + "/createdAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/createdAt/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" }];
32880
+ return false;
32881
+ }
32882
+ }
32883
+ }
32884
+ }
32885
+ var valid3 = _errs30 === errors;
32886
+ } else {
32887
+ var valid3 = true;
32888
+ }
32889
+ if (valid3) {
32890
+ if (data1.updatedAt !== void 0) {
32891
+ let data10 = data1.updatedAt;
32892
+ const _errs32 = errors;
32893
+ if (!(typeof data10 == "number" && (!(data10 % 1) && !isNaN(data10)) && isFinite(data10))) {
32894
+ validate56.errors = [{ instancePath: instancePath + "/apiKeys/" + i0 + "/updatedAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/updatedAt/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
32895
+ return false;
32896
+ }
32897
+ if (errors === _errs32) {
32898
+ if (typeof data10 == "number" && isFinite(data10)) {
32899
+ if (data10 > 9007199254740991 || isNaN(data10)) {
32900
+ validate56.errors = [{ instancePath: instancePath + "/apiKeys/" + i0 + "/updatedAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/updatedAt/maximum", keyword: "maximum", params: { comparison: "<=", limit: 9007199254740991 }, message: "must be <= 9007199254740991" }];
32901
+ return false;
32902
+ } else {
32903
+ if (data10 < 0 || isNaN(data10)) {
32904
+ validate56.errors = [{ instancePath: instancePath + "/apiKeys/" + i0 + "/updatedAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/properties/updatedAt/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" }];
32905
+ return false;
32906
+ }
32907
+ }
32908
+ }
32909
+ }
32910
+ var valid3 = _errs32 === errors;
32911
+ } else {
32912
+ var valid3 = true;
32913
+ }
32914
+ }
32915
+ }
32916
+ }
32917
+ }
32918
+ }
32919
+ }
32920
+ }
32921
+ }
32922
+ }
32923
+ } else {
32924
+ validate56.errors = [{ instancePath: instancePath + "/apiKeys/" + i0, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/items/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
32925
+ return false;
32926
+ }
32927
+ }
32928
+ var valid2 = _errs5 === errors;
32929
+ if (!valid2) {
32930
+ break;
32931
+ }
32932
+ }
32933
+ }
32934
+ } else {
32935
+ validate56.errors = [{ instancePath: instancePath + "/apiKeys", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/apiKeys/type", keyword: "type", params: { type: "array" }, message: "must be array" }];
32936
+ return false;
32937
+ }
32938
+ }
32939
+ var valid1 = _errs3 === errors;
32940
+ } else {
32941
+ var valid1 = true;
32942
+ }
32943
+ if (valid1) {
32944
+ if (data.nextCursor !== void 0) {
32945
+ let data11 = data.nextCursor;
32946
+ const _errs34 = errors;
32947
+ const _errs35 = errors;
32948
+ let valid7 = false;
32949
+ const _errs36 = errors;
32950
+ if (errors === _errs36) {
32951
+ if (typeof data11 === "string") {
32952
+ if (func1(data11) > 256) {
32953
+ const err10 = { instancePath: instancePath + "/nextCursor", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/nextCursor/anyOf/0/maxLength", keyword: "maxLength", params: { limit: 256 }, message: "must NOT have more than 256 characters" };
32954
+ if (vErrors === null) {
32955
+ vErrors = [err10];
32956
+ } else {
32957
+ vErrors.push(err10);
32958
+ }
32959
+ errors++;
32960
+ } else {
32961
+ if (func1(data11) < 9) {
32962
+ const err11 = { instancePath: instancePath + "/nextCursor", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/nextCursor/anyOf/0/minLength", keyword: "minLength", params: { limit: 9 }, message: "must NOT have fewer than 9 characters" };
32963
+ if (vErrors === null) {
32964
+ vErrors = [err11];
32965
+ } else {
32966
+ vErrors.push(err11);
32967
+ }
32968
+ errors++;
32969
+ } else {
32970
+ if (!pattern18.test(data11)) {
32971
+ const err12 = { instancePath: instancePath + "/nextCursor", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/nextCursor/anyOf/0/pattern", keyword: "pattern", params: { pattern: "^api_key_[A-Za-z0-9_-]+$" }, message: 'must match pattern "^api_key_[A-Za-z0-9_-]+$"' };
32972
+ if (vErrors === null) {
32973
+ vErrors = [err12];
32974
+ } else {
32975
+ vErrors.push(err12);
32976
+ }
32977
+ errors++;
32978
+ }
32979
+ }
32980
+ }
32981
+ } else {
32982
+ const err13 = { instancePath: instancePath + "/nextCursor", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/nextCursor/anyOf/0/type", keyword: "type", params: { type: "string" }, message: "must be string" };
32983
+ if (vErrors === null) {
32984
+ vErrors = [err13];
32985
+ } else {
32986
+ vErrors.push(err13);
32987
+ }
32988
+ errors++;
32989
+ }
32990
+ }
32991
+ var _valid2 = _errs36 === errors;
32992
+ valid7 = valid7 || _valid2;
32993
+ const _errs38 = errors;
32994
+ if (data11 !== null) {
32995
+ const err14 = { instancePath: instancePath + "/nextCursor", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/nextCursor/anyOf/1/type", keyword: "type", params: { type: "null" }, message: "must be null" };
32996
+ if (vErrors === null) {
32997
+ vErrors = [err14];
32998
+ } else {
32999
+ vErrors.push(err14);
33000
+ }
33001
+ errors++;
33002
+ }
33003
+ var _valid2 = _errs38 === errors;
33004
+ valid7 = valid7 || _valid2;
33005
+ if (!valid7) {
33006
+ const err15 = { instancePath: instancePath + "/nextCursor", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/properties/nextCursor/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
33007
+ if (vErrors === null) {
33008
+ vErrors = [err15];
33009
+ } else {
33010
+ vErrors.push(err15);
33011
+ }
33012
+ errors++;
33013
+ validate56.errors = vErrors;
33014
+ return false;
33015
+ } else {
33016
+ errors = _errs35;
33017
+ if (vErrors !== null) {
33018
+ if (_errs35) {
33019
+ vErrors.length = _errs35;
33020
+ } else {
33021
+ vErrors = null;
33022
+ }
33023
+ }
33024
+ }
33025
+ var valid1 = _errs34 === errors;
33026
+ } else {
33027
+ var valid1 = true;
33028
+ }
33029
+ }
33030
+ }
33031
+ }
33032
+ } else {
33033
+ validate56.errors = [{ instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyListResponse/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
33034
+ return false;
33035
+ }
33036
+ }
33037
+ validate56.errors = vErrors;
33038
+ return errors === 0;
33039
+ }
33040
+ validate56.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
33041
+ function validate57(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
33042
+ ;
33043
+ let vErrors = null;
33044
+ let errors = 0;
33045
+ const evaluated0 = validate57.evaluated;
33046
+ if (evaluated0.dynamicProps) {
33047
+ evaluated0.props = void 0;
33048
+ }
33049
+ if (evaluated0.dynamicItems) {
33050
+ evaluated0.items = void 0;
33051
+ }
33052
+ const _errs0 = errors;
33053
+ if (errors === _errs0) {
33054
+ if (data && typeof data == "object" && !Array.isArray(data)) {
33055
+ let missing0;
33056
+ if (data.id === void 0 && (missing0 = "id") || data.name === void 0 && (missing0 = "name") || data.obfuscatedValue === void 0 && (missing0 = "obfuscatedValue") || data.permissions === void 0 && (missing0 = "permissions") || data.lastUsedAt === void 0 && (missing0 = "lastUsedAt") || data.expiresAt === void 0 && (missing0 = "expiresAt") || data.createdAt === void 0 && (missing0 = "createdAt") || data.updatedAt === void 0 && (missing0 = "updatedAt")) {
33057
+ validate57.errors = [{ instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
33058
+ return false;
33059
+ } else {
33060
+ const _errs2 = errors;
33061
+ for (const key0 in data) {
33062
+ if (!(key0 === "id" || key0 === "name" || key0 === "obfuscatedValue" || key0 === "permissions" || key0 === "lastUsedAt" || key0 === "expiresAt" || key0 === "createdAt" || key0 === "updatedAt")) {
33063
+ validate57.errors = [{ instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }];
33064
+ return false;
33065
+ break;
33066
+ }
33067
+ }
33068
+ if (_errs2 === errors) {
33069
+ if (data.id !== void 0) {
33070
+ let data0 = data.id;
33071
+ const _errs3 = errors;
33072
+ if (errors === _errs3) {
33073
+ if (typeof data0 === "string") {
33074
+ if (func1(data0) > 256) {
33075
+ validate57.errors = [{ instancePath: instancePath + "/id", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/id/maxLength", keyword: "maxLength", params: { limit: 256 }, message: "must NOT have more than 256 characters" }];
33076
+ return false;
33077
+ } else {
33078
+ if (func1(data0) < 9) {
33079
+ validate57.errors = [{ instancePath: instancePath + "/id", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/id/minLength", keyword: "minLength", params: { limit: 9 }, message: "must NOT have fewer than 9 characters" }];
33080
+ return false;
33081
+ } else {
33082
+ if (!pattern18.test(data0)) {
33083
+ validate57.errors = [{ instancePath: instancePath + "/id", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/id/pattern", keyword: "pattern", params: { pattern: "^api_key_[A-Za-z0-9_-]+$" }, message: 'must match pattern "^api_key_[A-Za-z0-9_-]+$"' }];
33084
+ return false;
33085
+ }
33086
+ }
33087
+ }
33088
+ } else {
33089
+ validate57.errors = [{ instancePath: instancePath + "/id", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/id/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
33090
+ return false;
33091
+ }
33092
+ }
33093
+ var valid1 = _errs3 === errors;
33094
+ } else {
33095
+ var valid1 = true;
33096
+ }
33097
+ if (valid1) {
33098
+ if (data.name !== void 0) {
33099
+ let data1 = data.name;
33100
+ const _errs5 = errors;
33101
+ if (errors === _errs5) {
33102
+ if (typeof data1 === "string") {
33103
+ if (func1(data1) > 128) {
33104
+ validate57.errors = [{ instancePath: instancePath + "/name", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/name/maxLength", keyword: "maxLength", params: { limit: 128 }, message: "must NOT have more than 128 characters" }];
33105
+ return false;
33106
+ } else {
33107
+ if (func1(data1) < 1) {
33108
+ validate57.errors = [{ instancePath: instancePath + "/name", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/name/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" }];
33109
+ return false;
33110
+ } else {
33111
+ if (!pattern20.test(data1)) {
33112
+ validate57.errors = [{ instancePath: instancePath + "/name", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/name/pattern", keyword: "pattern", params: { pattern: "^[\\x21-\\x7e](?:[\\x20-\\x7e]{0,126}[\\x21-\\x7e])?$" }, message: 'must match pattern "^[\\x21-\\x7e](?:[\\x20-\\x7e]{0,126}[\\x21-\\x7e])?$"' }];
33113
+ return false;
33114
+ }
33115
+ }
33116
+ }
33117
+ } else {
33118
+ validate57.errors = [{ instancePath: instancePath + "/name", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/name/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
33119
+ return false;
33120
+ }
33121
+ }
33122
+ var valid1 = _errs5 === errors;
33123
+ } else {
33124
+ var valid1 = true;
33125
+ }
33126
+ if (valid1) {
33127
+ if (data.obfuscatedValue !== void 0) {
33128
+ let data2 = data.obfuscatedValue;
33129
+ const _errs7 = errors;
33130
+ if (errors === _errs7) {
33131
+ if (typeof data2 === "string") {
33132
+ if (func1(data2) > 256) {
33133
+ validate57.errors = [{ instancePath: instancePath + "/obfuscatedValue", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/obfuscatedValue/maxLength", keyword: "maxLength", params: { limit: 256 }, message: "must NOT have more than 256 characters" }];
33134
+ return false;
33135
+ } else {
33136
+ if (func1(data2) < 1) {
33137
+ validate57.errors = [{ instancePath: instancePath + "/obfuscatedValue", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/obfuscatedValue/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" }];
33138
+ return false;
33139
+ } else {
33140
+ if (!pattern21.test(data2)) {
33141
+ validate57.errors = [{ instancePath: instancePath + "/obfuscatedValue", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/obfuscatedValue/pattern", keyword: "pattern", params: { pattern: "^[^\\u0000-\\u001f\\u007f-\\u009f\\u2028\\u2029\\u061c\\u200b-\\u200f\\u202a-\\u202e\\u2060\\u2066-\\u2069\\ufeff]+$" }, message: 'must match pattern "^[^\\u0000-\\u001f\\u007f-\\u009f\\u2028\\u2029\\u061c\\u200b-\\u200f\\u202a-\\u202e\\u2060\\u2066-\\u2069\\ufeff]+$"' }];
33142
+ return false;
33143
+ }
33144
+ }
33145
+ }
33146
+ } else {
33147
+ validate57.errors = [{ instancePath: instancePath + "/obfuscatedValue", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/obfuscatedValue/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
33148
+ return false;
33149
+ }
33150
+ }
33151
+ var valid1 = _errs7 === errors;
33152
+ } else {
33153
+ var valid1 = true;
33154
+ }
33155
+ if (valid1) {
33156
+ if (data.permissions !== void 0) {
33157
+ let data3 = data.permissions;
33158
+ const _errs9 = errors;
33159
+ if (errors === _errs9) {
33160
+ if (Array.isArray(data3)) {
33161
+ if (data3.length > 100) {
33162
+ validate57.errors = [{ instancePath: instancePath + "/permissions", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/permissions/maxItems", keyword: "maxItems", params: { limit: 100 }, message: "must NOT have more than 100 items" }];
33163
+ return false;
33164
+ } else {
33165
+ var valid2 = true;
33166
+ const len0 = data3.length;
33167
+ for (let i0 = 0; i0 < len0; i0++) {
33168
+ let data4 = data3[i0];
33169
+ const _errs11 = errors;
33170
+ if (errors === _errs11) {
33171
+ if (typeof data4 === "string") {
33172
+ if (func1(data4) > 128) {
33173
+ validate57.errors = [{ instancePath: instancePath + "/permissions/" + i0, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/permissions/items/maxLength", keyword: "maxLength", params: { limit: 128 }, message: "must NOT have more than 128 characters" }];
33174
+ return false;
33175
+ } else {
33176
+ if (func1(data4) < 1) {
33177
+ validate57.errors = [{ instancePath: instancePath + "/permissions/" + i0, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/permissions/items/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" }];
33178
+ return false;
33179
+ } else {
33180
+ if (!pattern22.test(data4)) {
33181
+ validate57.errors = [{ instancePath: instancePath + "/permissions/" + i0, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/permissions/items/pattern", keyword: "pattern", params: { pattern: "^[\\x21-\\x7e]+$" }, message: 'must match pattern "^[\\x21-\\x7e]+$"' }];
33182
+ return false;
33183
+ }
33184
+ }
33185
+ }
33186
+ } else {
33187
+ validate57.errors = [{ instancePath: instancePath + "/permissions/" + i0, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/permissions/items/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
33188
+ return false;
33189
+ }
33190
+ }
33191
+ var valid2 = _errs11 === errors;
33192
+ if (!valid2) {
33193
+ break;
33194
+ }
33195
+ }
33196
+ }
33197
+ } else {
33198
+ validate57.errors = [{ instancePath: instancePath + "/permissions", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/permissions/type", keyword: "type", params: { type: "array" }, message: "must be array" }];
33199
+ return false;
33200
+ }
33201
+ }
33202
+ var valid1 = _errs9 === errors;
33203
+ } else {
33204
+ var valid1 = true;
33205
+ }
33206
+ if (valid1) {
33207
+ if (data.lastUsedAt !== void 0) {
33208
+ let data5 = data.lastUsedAt;
33209
+ const _errs13 = errors;
33210
+ const _errs14 = errors;
33211
+ let valid3 = false;
33212
+ const _errs15 = errors;
33213
+ if (!(typeof data5 == "number" && (!(data5 % 1) && !isNaN(data5)) && isFinite(data5))) {
33214
+ const err0 = { instancePath: instancePath + "/lastUsedAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/lastUsedAt/anyOf/0/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
33215
+ if (vErrors === null) {
33216
+ vErrors = [err0];
33217
+ } else {
33218
+ vErrors.push(err0);
33219
+ }
33220
+ errors++;
33221
+ }
33222
+ if (errors === _errs15) {
33223
+ if (typeof data5 == "number" && isFinite(data5)) {
33224
+ if (data5 > 9007199254740991 || isNaN(data5)) {
33225
+ const err1 = { instancePath: instancePath + "/lastUsedAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/lastUsedAt/anyOf/0/maximum", keyword: "maximum", params: { comparison: "<=", limit: 9007199254740991 }, message: "must be <= 9007199254740991" };
33226
+ if (vErrors === null) {
33227
+ vErrors = [err1];
33228
+ } else {
33229
+ vErrors.push(err1);
33230
+ }
33231
+ errors++;
33232
+ } else {
33233
+ if (data5 < 0 || isNaN(data5)) {
33234
+ const err2 = { instancePath: instancePath + "/lastUsedAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/lastUsedAt/anyOf/0/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" };
33235
+ if (vErrors === null) {
33236
+ vErrors = [err2];
33237
+ } else {
33238
+ vErrors.push(err2);
33239
+ }
33240
+ errors++;
33241
+ }
33242
+ }
33243
+ }
33244
+ }
33245
+ var _valid0 = _errs15 === errors;
33246
+ valid3 = valid3 || _valid0;
33247
+ const _errs17 = errors;
33248
+ if (data5 !== null) {
33249
+ const err3 = { instancePath: instancePath + "/lastUsedAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/lastUsedAt/anyOf/1/type", keyword: "type", params: { type: "null" }, message: "must be null" };
33250
+ if (vErrors === null) {
33251
+ vErrors = [err3];
33252
+ } else {
33253
+ vErrors.push(err3);
33254
+ }
33255
+ errors++;
33256
+ }
33257
+ var _valid0 = _errs17 === errors;
33258
+ valid3 = valid3 || _valid0;
33259
+ if (!valid3) {
33260
+ const err4 = { instancePath: instancePath + "/lastUsedAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/lastUsedAt/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
33261
+ if (vErrors === null) {
33262
+ vErrors = [err4];
33263
+ } else {
33264
+ vErrors.push(err4);
33265
+ }
33266
+ errors++;
33267
+ validate57.errors = vErrors;
33268
+ return false;
33269
+ } else {
33270
+ errors = _errs14;
33271
+ if (vErrors !== null) {
33272
+ if (_errs14) {
33273
+ vErrors.length = _errs14;
33274
+ } else {
33275
+ vErrors = null;
33276
+ }
33277
+ }
33278
+ }
33279
+ var valid1 = _errs13 === errors;
33280
+ } else {
33281
+ var valid1 = true;
33282
+ }
33283
+ if (valid1) {
33284
+ if (data.expiresAt !== void 0) {
33285
+ let data6 = data.expiresAt;
33286
+ const _errs19 = errors;
33287
+ const _errs20 = errors;
33288
+ let valid4 = false;
33289
+ const _errs21 = errors;
33290
+ if (!(typeof data6 == "number" && (!(data6 % 1) && !isNaN(data6)) && isFinite(data6))) {
33291
+ const err5 = { instancePath: instancePath + "/expiresAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/expiresAt/anyOf/0/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
33292
+ if (vErrors === null) {
33293
+ vErrors = [err5];
33294
+ } else {
33295
+ vErrors.push(err5);
33296
+ }
33297
+ errors++;
33298
+ }
33299
+ if (errors === _errs21) {
33300
+ if (typeof data6 == "number" && isFinite(data6)) {
33301
+ if (data6 > 9007199254740991 || isNaN(data6)) {
33302
+ const err6 = { instancePath: instancePath + "/expiresAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/expiresAt/anyOf/0/maximum", keyword: "maximum", params: { comparison: "<=", limit: 9007199254740991 }, message: "must be <= 9007199254740991" };
33303
+ if (vErrors === null) {
33304
+ vErrors = [err6];
33305
+ } else {
33306
+ vErrors.push(err6);
33307
+ }
33308
+ errors++;
33309
+ } else {
33310
+ if (data6 < 0 || isNaN(data6)) {
33311
+ const err7 = { instancePath: instancePath + "/expiresAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/expiresAt/anyOf/0/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" };
33312
+ if (vErrors === null) {
33313
+ vErrors = [err7];
33314
+ } else {
33315
+ vErrors.push(err7);
33316
+ }
33317
+ errors++;
33318
+ }
33319
+ }
33320
+ }
33321
+ }
33322
+ var _valid1 = _errs21 === errors;
33323
+ valid4 = valid4 || _valid1;
33324
+ const _errs23 = errors;
33325
+ if (data6 !== null) {
33326
+ const err8 = { instancePath: instancePath + "/expiresAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/expiresAt/anyOf/1/type", keyword: "type", params: { type: "null" }, message: "must be null" };
33327
+ if (vErrors === null) {
33328
+ vErrors = [err8];
33329
+ } else {
33330
+ vErrors.push(err8);
33331
+ }
33332
+ errors++;
33333
+ }
33334
+ var _valid1 = _errs23 === errors;
33335
+ valid4 = valid4 || _valid1;
33336
+ if (!valid4) {
33337
+ const err9 = { instancePath: instancePath + "/expiresAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/expiresAt/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
33338
+ if (vErrors === null) {
33339
+ vErrors = [err9];
33340
+ } else {
33341
+ vErrors.push(err9);
33342
+ }
33343
+ errors++;
33344
+ validate57.errors = vErrors;
33345
+ return false;
33346
+ } else {
33347
+ errors = _errs20;
33348
+ if (vErrors !== null) {
33349
+ if (_errs20) {
33350
+ vErrors.length = _errs20;
33351
+ } else {
33352
+ vErrors = null;
33353
+ }
33354
+ }
33355
+ }
33356
+ var valid1 = _errs19 === errors;
33357
+ } else {
33358
+ var valid1 = true;
33359
+ }
33360
+ if (valid1) {
33361
+ if (data.createdAt !== void 0) {
33362
+ let data7 = data.createdAt;
33363
+ const _errs25 = errors;
33364
+ if (!(typeof data7 == "number" && (!(data7 % 1) && !isNaN(data7)) && isFinite(data7))) {
33365
+ validate57.errors = [{ instancePath: instancePath + "/createdAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/createdAt/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
33366
+ return false;
33367
+ }
33368
+ if (errors === _errs25) {
33369
+ if (typeof data7 == "number" && isFinite(data7)) {
33370
+ if (data7 > 9007199254740991 || isNaN(data7)) {
33371
+ validate57.errors = [{ instancePath: instancePath + "/createdAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/createdAt/maximum", keyword: "maximum", params: { comparison: "<=", limit: 9007199254740991 }, message: "must be <= 9007199254740991" }];
33372
+ return false;
33373
+ } else {
33374
+ if (data7 < 0 || isNaN(data7)) {
33375
+ validate57.errors = [{ instancePath: instancePath + "/createdAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/createdAt/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" }];
33376
+ return false;
33377
+ }
33378
+ }
33379
+ }
33380
+ }
33381
+ var valid1 = _errs25 === errors;
33382
+ } else {
33383
+ var valid1 = true;
33384
+ }
33385
+ if (valid1) {
33386
+ if (data.updatedAt !== void 0) {
33387
+ let data8 = data.updatedAt;
33388
+ const _errs27 = errors;
33389
+ if (!(typeof data8 == "number" && (!(data8 % 1) && !isNaN(data8)) && isFinite(data8))) {
33390
+ validate57.errors = [{ instancePath: instancePath + "/updatedAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/updatedAt/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
33391
+ return false;
33392
+ }
33393
+ if (errors === _errs27) {
33394
+ if (typeof data8 == "number" && isFinite(data8)) {
33395
+ if (data8 > 9007199254740991 || isNaN(data8)) {
33396
+ validate57.errors = [{ instancePath: instancePath + "/updatedAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/updatedAt/maximum", keyword: "maximum", params: { comparison: "<=", limit: 9007199254740991 }, message: "must be <= 9007199254740991" }];
33397
+ return false;
33398
+ } else {
33399
+ if (data8 < 0 || isNaN(data8)) {
33400
+ validate57.errors = [{ instancePath: instancePath + "/updatedAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/properties/updatedAt/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" }];
33401
+ return false;
33402
+ }
33403
+ }
33404
+ }
33405
+ }
33406
+ var valid1 = _errs27 === errors;
33407
+ } else {
33408
+ var valid1 = true;
33409
+ }
33410
+ }
33411
+ }
33412
+ }
33413
+ }
33414
+ }
33415
+ }
33416
+ }
33417
+ }
33418
+ }
33419
+ } else {
33420
+ validate57.errors = [{ instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMetadata/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
33421
+ return false;
33422
+ }
33423
+ }
33424
+ validate57.errors = vErrors;
33425
+ return errors === 0;
33426
+ }
33427
+ validate57.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
33428
+ function validate58(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
33429
+ ;
33430
+ let vErrors = null;
33431
+ let errors = 0;
33432
+ const evaluated0 = validate58.evaluated;
33433
+ if (evaluated0.dynamicProps) {
33434
+ evaluated0.props = void 0;
33435
+ }
33436
+ if (evaluated0.dynamicItems) {
33437
+ evaluated0.items = void 0;
33438
+ }
33439
+ const _errs0 = errors;
33440
+ if (errors === _errs0) {
33441
+ if (data && typeof data == "object" && !Array.isArray(data)) {
33442
+ let missing0;
33443
+ if (data.requestId === void 0 && (missing0 = "requestId") || data.name === void 0 && (missing0 = "name")) {
33444
+ validate58.errors = [{ instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintRequest/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
33445
+ return false;
33446
+ } else {
33447
+ const _errs2 = errors;
33448
+ for (const key0 in data) {
33449
+ if (!(key0 === "requestId" || key0 === "name" || key0 === "expiresAt")) {
33450
+ validate58.errors = [{ instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintRequest/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }];
33451
+ return false;
33452
+ break;
33453
+ }
33454
+ }
33455
+ if (_errs2 === errors) {
33456
+ if (data.requestId !== void 0) {
33457
+ let data0 = data.requestId;
33458
+ const _errs3 = errors;
33459
+ if (errors === _errs3) {
33460
+ if (typeof data0 === "string") {
33461
+ if (!pattern17.test(data0)) {
33462
+ validate58.errors = [{ instancePath: instancePath + "/requestId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintRequest/properties/requestId/pattern", keyword: "pattern", params: { pattern: "^[a-f0-9]{64}$" }, message: 'must match pattern "^[a-f0-9]{64}$"' }];
33463
+ return false;
33464
+ }
33465
+ } else {
33466
+ validate58.errors = [{ instancePath: instancePath + "/requestId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintRequest/properties/requestId/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
33467
+ return false;
33468
+ }
33469
+ }
33470
+ var valid1 = _errs3 === errors;
33471
+ } else {
33472
+ var valid1 = true;
33473
+ }
33474
+ if (valid1) {
33475
+ if (data.name !== void 0) {
33476
+ let data1 = data.name;
33477
+ const _errs5 = errors;
33478
+ if (errors === _errs5) {
33479
+ if (typeof data1 === "string") {
33480
+ if (func1(data1) > 128) {
33481
+ validate58.errors = [{ instancePath: instancePath + "/name", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintRequest/properties/name/maxLength", keyword: "maxLength", params: { limit: 128 }, message: "must NOT have more than 128 characters" }];
33482
+ return false;
33483
+ } else {
33484
+ if (func1(data1) < 1) {
33485
+ validate58.errors = [{ instancePath: instancePath + "/name", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintRequest/properties/name/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" }];
33486
+ return false;
33487
+ } else {
33488
+ if (!pattern20.test(data1)) {
33489
+ validate58.errors = [{ instancePath: instancePath + "/name", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintRequest/properties/name/pattern", keyword: "pattern", params: { pattern: "^[\\x21-\\x7e](?:[\\x20-\\x7e]{0,126}[\\x21-\\x7e])?$" }, message: 'must match pattern "^[\\x21-\\x7e](?:[\\x20-\\x7e]{0,126}[\\x21-\\x7e])?$"' }];
33490
+ return false;
33491
+ }
33492
+ }
33493
+ }
33494
+ } else {
33495
+ validate58.errors = [{ instancePath: instancePath + "/name", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintRequest/properties/name/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
33496
+ return false;
33497
+ }
33498
+ }
33499
+ var valid1 = _errs5 === errors;
33500
+ } else {
33501
+ var valid1 = true;
33502
+ }
33503
+ if (valid1) {
33504
+ if (data.expiresAt !== void 0) {
33505
+ let data2 = data.expiresAt;
33506
+ const _errs7 = errors;
33507
+ if (!(typeof data2 == "number" && (!(data2 % 1) && !isNaN(data2)) && isFinite(data2))) {
33508
+ validate58.errors = [{ instancePath: instancePath + "/expiresAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintRequest/properties/expiresAt/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
33509
+ return false;
33510
+ }
33511
+ if (errors === _errs7) {
33512
+ if (typeof data2 == "number" && isFinite(data2)) {
33513
+ if (data2 > 9007199254740991 || isNaN(data2)) {
33514
+ validate58.errors = [{ instancePath: instancePath + "/expiresAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintRequest/properties/expiresAt/maximum", keyword: "maximum", params: { comparison: "<=", limit: 9007199254740991 }, message: "must be <= 9007199254740991" }];
33515
+ return false;
33516
+ } else {
33517
+ if (data2 < 0 || isNaN(data2)) {
33518
+ validate58.errors = [{ instancePath: instancePath + "/expiresAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintRequest/properties/expiresAt/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" }];
33519
+ return false;
33520
+ }
33521
+ }
33522
+ }
33523
+ }
33524
+ var valid1 = _errs7 === errors;
33525
+ } else {
33526
+ var valid1 = true;
33527
+ }
33528
+ }
33529
+ }
33530
+ }
33531
+ }
33532
+ } else {
33533
+ validate58.errors = [{ instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintRequest/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
33534
+ return false;
33535
+ }
33536
+ }
33537
+ validate58.errors = vErrors;
33538
+ return errors === 0;
33539
+ }
33540
+ validate58.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
33541
+ var pattern34 = new RegExp("^sk_[\\x21-\\x7e]+(?: [\\x21-\\x7e]+)*$", "u");
33542
+ function validate59(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
33543
+ ;
33544
+ let vErrors = null;
33545
+ let errors = 0;
33546
+ const evaluated0 = validate59.evaluated;
33547
+ if (evaluated0.dynamicProps) {
33548
+ evaluated0.props = void 0;
33549
+ }
33550
+ if (evaluated0.dynamicItems) {
33551
+ evaluated0.items = void 0;
33552
+ }
33553
+ const _errs0 = errors;
33554
+ if (errors === _errs0) {
33555
+ if (data && typeof data == "object" && !Array.isArray(data)) {
33556
+ let missing0;
33557
+ if (data.apiKey === void 0 && (missing0 = "apiKey") || data.secret === void 0 && (missing0 = "secret")) {
33558
+ validate59.errors = [{ instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
33559
+ return false;
33560
+ } else {
33561
+ const _errs2 = errors;
33562
+ for (const key0 in data) {
33563
+ if (!(key0 === "apiKey" || key0 === "secret")) {
33564
+ validate59.errors = [{ instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }];
33565
+ return false;
33566
+ break;
33567
+ }
33568
+ }
33569
+ if (_errs2 === errors) {
33570
+ if (data.apiKey !== void 0) {
33571
+ let data0 = data.apiKey;
33572
+ const _errs3 = errors;
33573
+ if (errors === _errs3) {
33574
+ if (data0 && typeof data0 == "object" && !Array.isArray(data0)) {
33575
+ let missing1;
33576
+ if (data0.id === void 0 && (missing1 = "id") || data0.name === void 0 && (missing1 = "name") || data0.obfuscatedValue === void 0 && (missing1 = "obfuscatedValue") || data0.permissions === void 0 && (missing1 = "permissions") || data0.lastUsedAt === void 0 && (missing1 = "lastUsedAt") || data0.expiresAt === void 0 && (missing1 = "expiresAt") || data0.createdAt === void 0 && (missing1 = "createdAt") || data0.updatedAt === void 0 && (missing1 = "updatedAt")) {
33577
+ validate59.errors = [{ instancePath: instancePath + "/apiKey", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" }];
33578
+ return false;
33579
+ } else {
33580
+ const _errs5 = errors;
33581
+ for (const key1 in data0) {
33582
+ if (!(key1 === "id" || key1 === "name" || key1 === "obfuscatedValue" || key1 === "permissions" || key1 === "lastUsedAt" || key1 === "expiresAt" || key1 === "createdAt" || key1 === "updatedAt")) {
33583
+ validate59.errors = [{ instancePath: instancePath + "/apiKey", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key1 }, message: "must NOT have additional properties" }];
33584
+ return false;
33585
+ break;
33586
+ }
33587
+ }
33588
+ if (_errs5 === errors) {
33589
+ if (data0.id !== void 0) {
33590
+ let data1 = data0.id;
33591
+ const _errs6 = errors;
33592
+ if (errors === _errs6) {
33593
+ if (typeof data1 === "string") {
33594
+ if (func1(data1) > 256) {
33595
+ validate59.errors = [{ instancePath: instancePath + "/apiKey/id", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/id/maxLength", keyword: "maxLength", params: { limit: 256 }, message: "must NOT have more than 256 characters" }];
33596
+ return false;
33597
+ } else {
33598
+ if (func1(data1) < 9) {
33599
+ validate59.errors = [{ instancePath: instancePath + "/apiKey/id", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/id/minLength", keyword: "minLength", params: { limit: 9 }, message: "must NOT have fewer than 9 characters" }];
33600
+ return false;
33601
+ } else {
33602
+ if (!pattern18.test(data1)) {
33603
+ validate59.errors = [{ instancePath: instancePath + "/apiKey/id", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/id/pattern", keyword: "pattern", params: { pattern: "^api_key_[A-Za-z0-9_-]+$" }, message: 'must match pattern "^api_key_[A-Za-z0-9_-]+$"' }];
33604
+ return false;
33605
+ }
33606
+ }
33607
+ }
33608
+ } else {
33609
+ validate59.errors = [{ instancePath: instancePath + "/apiKey/id", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/id/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
33610
+ return false;
33611
+ }
33612
+ }
33613
+ var valid2 = _errs6 === errors;
33614
+ } else {
33615
+ var valid2 = true;
33616
+ }
33617
+ if (valid2) {
33618
+ if (data0.name !== void 0) {
33619
+ let data2 = data0.name;
33620
+ const _errs8 = errors;
33621
+ if (errors === _errs8) {
33622
+ if (typeof data2 === "string") {
33623
+ if (func1(data2) > 128) {
33624
+ validate59.errors = [{ instancePath: instancePath + "/apiKey/name", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/name/maxLength", keyword: "maxLength", params: { limit: 128 }, message: "must NOT have more than 128 characters" }];
33625
+ return false;
33626
+ } else {
33627
+ if (func1(data2) < 1) {
33628
+ validate59.errors = [{ instancePath: instancePath + "/apiKey/name", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/name/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" }];
33629
+ return false;
33630
+ } else {
33631
+ if (!pattern20.test(data2)) {
33632
+ validate59.errors = [{ instancePath: instancePath + "/apiKey/name", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/name/pattern", keyword: "pattern", params: { pattern: "^[\\x21-\\x7e](?:[\\x20-\\x7e]{0,126}[\\x21-\\x7e])?$" }, message: 'must match pattern "^[\\x21-\\x7e](?:[\\x20-\\x7e]{0,126}[\\x21-\\x7e])?$"' }];
33633
+ return false;
33634
+ }
33635
+ }
33636
+ }
33637
+ } else {
33638
+ validate59.errors = [{ instancePath: instancePath + "/apiKey/name", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/name/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
33639
+ return false;
33640
+ }
33641
+ }
33642
+ var valid2 = _errs8 === errors;
33643
+ } else {
33644
+ var valid2 = true;
33645
+ }
33646
+ if (valid2) {
33647
+ if (data0.obfuscatedValue !== void 0) {
33648
+ let data3 = data0.obfuscatedValue;
33649
+ const _errs10 = errors;
33650
+ if (errors === _errs10) {
33651
+ if (typeof data3 === "string") {
33652
+ if (func1(data3) > 256) {
33653
+ validate59.errors = [{ instancePath: instancePath + "/apiKey/obfuscatedValue", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/obfuscatedValue/maxLength", keyword: "maxLength", params: { limit: 256 }, message: "must NOT have more than 256 characters" }];
33654
+ return false;
33655
+ } else {
33656
+ if (func1(data3) < 1) {
33657
+ validate59.errors = [{ instancePath: instancePath + "/apiKey/obfuscatedValue", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/obfuscatedValue/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" }];
33658
+ return false;
33659
+ } else {
33660
+ if (!pattern21.test(data3)) {
33661
+ validate59.errors = [{ instancePath: instancePath + "/apiKey/obfuscatedValue", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/obfuscatedValue/pattern", keyword: "pattern", params: { pattern: "^[^\\u0000-\\u001f\\u007f-\\u009f\\u2028\\u2029\\u061c\\u200b-\\u200f\\u202a-\\u202e\\u2060\\u2066-\\u2069\\ufeff]+$" }, message: 'must match pattern "^[^\\u0000-\\u001f\\u007f-\\u009f\\u2028\\u2029\\u061c\\u200b-\\u200f\\u202a-\\u202e\\u2060\\u2066-\\u2069\\ufeff]+$"' }];
33662
+ return false;
33663
+ }
33664
+ }
33665
+ }
33666
+ } else {
33667
+ validate59.errors = [{ instancePath: instancePath + "/apiKey/obfuscatedValue", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/obfuscatedValue/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
33668
+ return false;
33669
+ }
33670
+ }
33671
+ var valid2 = _errs10 === errors;
33672
+ } else {
33673
+ var valid2 = true;
33674
+ }
33675
+ if (valid2) {
33676
+ if (data0.permissions !== void 0) {
33677
+ let data4 = data0.permissions;
33678
+ const _errs12 = errors;
33679
+ if (errors === _errs12) {
33680
+ if (Array.isArray(data4)) {
33681
+ if (data4.length > 100) {
33682
+ validate59.errors = [{ instancePath: instancePath + "/apiKey/permissions", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/permissions/maxItems", keyword: "maxItems", params: { limit: 100 }, message: "must NOT have more than 100 items" }];
33683
+ return false;
33684
+ } else {
33685
+ var valid3 = true;
33686
+ const len0 = data4.length;
33687
+ for (let i0 = 0; i0 < len0; i0++) {
33688
+ let data5 = data4[i0];
33689
+ const _errs14 = errors;
33690
+ if (errors === _errs14) {
33691
+ if (typeof data5 === "string") {
33692
+ if (func1(data5) > 128) {
33693
+ validate59.errors = [{ instancePath: instancePath + "/apiKey/permissions/" + i0, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/permissions/items/maxLength", keyword: "maxLength", params: { limit: 128 }, message: "must NOT have more than 128 characters" }];
33694
+ return false;
33695
+ } else {
33696
+ if (func1(data5) < 1) {
33697
+ validate59.errors = [{ instancePath: instancePath + "/apiKey/permissions/" + i0, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/permissions/items/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" }];
33698
+ return false;
33699
+ } else {
33700
+ if (!pattern22.test(data5)) {
33701
+ validate59.errors = [{ instancePath: instancePath + "/apiKey/permissions/" + i0, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/permissions/items/pattern", keyword: "pattern", params: { pattern: "^[\\x21-\\x7e]+$" }, message: 'must match pattern "^[\\x21-\\x7e]+$"' }];
33702
+ return false;
33703
+ }
33704
+ }
33705
+ }
33706
+ } else {
33707
+ validate59.errors = [{ instancePath: instancePath + "/apiKey/permissions/" + i0, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/permissions/items/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
33708
+ return false;
33709
+ }
33710
+ }
33711
+ var valid3 = _errs14 === errors;
33712
+ if (!valid3) {
33713
+ break;
33714
+ }
33715
+ }
33716
+ }
33717
+ } else {
33718
+ validate59.errors = [{ instancePath: instancePath + "/apiKey/permissions", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/permissions/type", keyword: "type", params: { type: "array" }, message: "must be array" }];
33719
+ return false;
33720
+ }
33721
+ }
33722
+ var valid2 = _errs12 === errors;
33723
+ } else {
33724
+ var valid2 = true;
33725
+ }
33726
+ if (valid2) {
33727
+ if (data0.lastUsedAt !== void 0) {
33728
+ let data6 = data0.lastUsedAt;
33729
+ const _errs16 = errors;
33730
+ const _errs17 = errors;
33731
+ let valid4 = false;
33732
+ const _errs18 = errors;
33733
+ if (!(typeof data6 == "number" && (!(data6 % 1) && !isNaN(data6)) && isFinite(data6))) {
33734
+ const err0 = { instancePath: instancePath + "/apiKey/lastUsedAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/lastUsedAt/anyOf/0/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
33735
+ if (vErrors === null) {
33736
+ vErrors = [err0];
33737
+ } else {
33738
+ vErrors.push(err0);
33739
+ }
33740
+ errors++;
33741
+ }
33742
+ if (errors === _errs18) {
33743
+ if (typeof data6 == "number" && isFinite(data6)) {
33744
+ if (data6 > 9007199254740991 || isNaN(data6)) {
33745
+ const err1 = { instancePath: instancePath + "/apiKey/lastUsedAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/lastUsedAt/anyOf/0/maximum", keyword: "maximum", params: { comparison: "<=", limit: 9007199254740991 }, message: "must be <= 9007199254740991" };
33746
+ if (vErrors === null) {
33747
+ vErrors = [err1];
33748
+ } else {
33749
+ vErrors.push(err1);
33750
+ }
33751
+ errors++;
33752
+ } else {
33753
+ if (data6 < 0 || isNaN(data6)) {
33754
+ const err2 = { instancePath: instancePath + "/apiKey/lastUsedAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/lastUsedAt/anyOf/0/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" };
33755
+ if (vErrors === null) {
33756
+ vErrors = [err2];
33757
+ } else {
33758
+ vErrors.push(err2);
33759
+ }
33760
+ errors++;
33761
+ }
33762
+ }
33763
+ }
33764
+ }
33765
+ var _valid0 = _errs18 === errors;
33766
+ valid4 = valid4 || _valid0;
33767
+ const _errs20 = errors;
33768
+ if (data6 !== null) {
33769
+ const err3 = { instancePath: instancePath + "/apiKey/lastUsedAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/lastUsedAt/anyOf/1/type", keyword: "type", params: { type: "null" }, message: "must be null" };
33770
+ if (vErrors === null) {
33771
+ vErrors = [err3];
33772
+ } else {
33773
+ vErrors.push(err3);
33774
+ }
33775
+ errors++;
33776
+ }
33777
+ var _valid0 = _errs20 === errors;
33778
+ valid4 = valid4 || _valid0;
33779
+ if (!valid4) {
33780
+ const err4 = { instancePath: instancePath + "/apiKey/lastUsedAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/lastUsedAt/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
33781
+ if (vErrors === null) {
33782
+ vErrors = [err4];
33783
+ } else {
33784
+ vErrors.push(err4);
33785
+ }
33786
+ errors++;
33787
+ validate59.errors = vErrors;
33788
+ return false;
33789
+ } else {
33790
+ errors = _errs17;
33791
+ if (vErrors !== null) {
33792
+ if (_errs17) {
33793
+ vErrors.length = _errs17;
33794
+ } else {
33795
+ vErrors = null;
33796
+ }
33797
+ }
33798
+ }
33799
+ var valid2 = _errs16 === errors;
33800
+ } else {
33801
+ var valid2 = true;
33802
+ }
33803
+ if (valid2) {
33804
+ if (data0.expiresAt !== void 0) {
33805
+ let data7 = data0.expiresAt;
33806
+ const _errs22 = errors;
33807
+ const _errs23 = errors;
33808
+ let valid5 = false;
33809
+ const _errs24 = errors;
33810
+ if (!(typeof data7 == "number" && (!(data7 % 1) && !isNaN(data7)) && isFinite(data7))) {
33811
+ const err5 = { instancePath: instancePath + "/apiKey/expiresAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/expiresAt/anyOf/0/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
33812
+ if (vErrors === null) {
33813
+ vErrors = [err5];
33814
+ } else {
33815
+ vErrors.push(err5);
33816
+ }
33817
+ errors++;
33818
+ }
33819
+ if (errors === _errs24) {
33820
+ if (typeof data7 == "number" && isFinite(data7)) {
33821
+ if (data7 > 9007199254740991 || isNaN(data7)) {
33822
+ const err6 = { instancePath: instancePath + "/apiKey/expiresAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/expiresAt/anyOf/0/maximum", keyword: "maximum", params: { comparison: "<=", limit: 9007199254740991 }, message: "must be <= 9007199254740991" };
33823
+ if (vErrors === null) {
33824
+ vErrors = [err6];
33825
+ } else {
33826
+ vErrors.push(err6);
33827
+ }
33828
+ errors++;
33829
+ } else {
33830
+ if (data7 < 0 || isNaN(data7)) {
33831
+ const err7 = { instancePath: instancePath + "/apiKey/expiresAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/expiresAt/anyOf/0/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" };
33832
+ if (vErrors === null) {
33833
+ vErrors = [err7];
33834
+ } else {
33835
+ vErrors.push(err7);
33836
+ }
33837
+ errors++;
33838
+ }
33839
+ }
33840
+ }
33841
+ }
33842
+ var _valid1 = _errs24 === errors;
33843
+ valid5 = valid5 || _valid1;
33844
+ const _errs26 = errors;
33845
+ if (data7 !== null) {
33846
+ const err8 = { instancePath: instancePath + "/apiKey/expiresAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/expiresAt/anyOf/1/type", keyword: "type", params: { type: "null" }, message: "must be null" };
33847
+ if (vErrors === null) {
33848
+ vErrors = [err8];
33849
+ } else {
33850
+ vErrors.push(err8);
33851
+ }
33852
+ errors++;
33853
+ }
33854
+ var _valid1 = _errs26 === errors;
33855
+ valid5 = valid5 || _valid1;
33856
+ if (!valid5) {
33857
+ const err9 = { instancePath: instancePath + "/apiKey/expiresAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/expiresAt/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
33858
+ if (vErrors === null) {
33859
+ vErrors = [err9];
33860
+ } else {
33861
+ vErrors.push(err9);
33862
+ }
33863
+ errors++;
33864
+ validate59.errors = vErrors;
33865
+ return false;
33866
+ } else {
33867
+ errors = _errs23;
33868
+ if (vErrors !== null) {
33869
+ if (_errs23) {
33870
+ vErrors.length = _errs23;
33871
+ } else {
33872
+ vErrors = null;
33873
+ }
33874
+ }
33875
+ }
33876
+ var valid2 = _errs22 === errors;
33877
+ } else {
33878
+ var valid2 = true;
33879
+ }
33880
+ if (valid2) {
33881
+ if (data0.createdAt !== void 0) {
33882
+ let data8 = data0.createdAt;
33883
+ const _errs28 = errors;
33884
+ if (!(typeof data8 == "number" && (!(data8 % 1) && !isNaN(data8)) && isFinite(data8))) {
33885
+ validate59.errors = [{ instancePath: instancePath + "/apiKey/createdAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/createdAt/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
33886
+ return false;
33887
+ }
33888
+ if (errors === _errs28) {
33889
+ if (typeof data8 == "number" && isFinite(data8)) {
33890
+ if (data8 > 9007199254740991 || isNaN(data8)) {
33891
+ validate59.errors = [{ instancePath: instancePath + "/apiKey/createdAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/createdAt/maximum", keyword: "maximum", params: { comparison: "<=", limit: 9007199254740991 }, message: "must be <= 9007199254740991" }];
33892
+ return false;
33893
+ } else {
33894
+ if (data8 < 0 || isNaN(data8)) {
33895
+ validate59.errors = [{ instancePath: instancePath + "/apiKey/createdAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/createdAt/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" }];
33896
+ return false;
33897
+ }
33898
+ }
33899
+ }
33900
+ }
33901
+ var valid2 = _errs28 === errors;
33902
+ } else {
33903
+ var valid2 = true;
33904
+ }
33905
+ if (valid2) {
33906
+ if (data0.updatedAt !== void 0) {
33907
+ let data9 = data0.updatedAt;
33908
+ const _errs30 = errors;
33909
+ if (!(typeof data9 == "number" && (!(data9 % 1) && !isNaN(data9)) && isFinite(data9))) {
33910
+ validate59.errors = [{ instancePath: instancePath + "/apiKey/updatedAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/updatedAt/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
33911
+ return false;
33912
+ }
33913
+ if (errors === _errs30) {
33914
+ if (typeof data9 == "number" && isFinite(data9)) {
33915
+ if (data9 > 9007199254740991 || isNaN(data9)) {
33916
+ validate59.errors = [{ instancePath: instancePath + "/apiKey/updatedAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/updatedAt/maximum", keyword: "maximum", params: { comparison: "<=", limit: 9007199254740991 }, message: "must be <= 9007199254740991" }];
33917
+ return false;
33918
+ } else {
33919
+ if (data9 < 0 || isNaN(data9)) {
33920
+ validate59.errors = [{ instancePath: instancePath + "/apiKey/updatedAt", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/properties/updatedAt/minimum", keyword: "minimum", params: { comparison: ">=", limit: 0 }, message: "must be >= 0" }];
33921
+ return false;
33922
+ }
33923
+ }
33924
+ }
33925
+ }
33926
+ var valid2 = _errs30 === errors;
33927
+ } else {
33928
+ var valid2 = true;
33929
+ }
33930
+ }
33931
+ }
33932
+ }
33933
+ }
33934
+ }
33935
+ }
33936
+ }
33937
+ }
33938
+ }
33939
+ } else {
33940
+ validate59.errors = [{ instancePath: instancePath + "/apiKey", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/apiKey/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
33941
+ return false;
33942
+ }
33943
+ }
33944
+ var valid1 = _errs3 === errors;
33945
+ } else {
33946
+ var valid1 = true;
33947
+ }
33948
+ if (valid1) {
33949
+ if (data.secret !== void 0) {
33950
+ let data10 = data.secret;
33951
+ const _errs32 = errors;
33952
+ if (errors === _errs32) {
33953
+ if (typeof data10 === "string") {
33954
+ if (func1(data10) > 4096) {
33955
+ validate59.errors = [{ instancePath: instancePath + "/secret", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/secret/maxLength", keyword: "maxLength", params: { limit: 4096 }, message: "must NOT have more than 4096 characters" }];
33956
+ return false;
33957
+ } else {
33958
+ if (func1(data10) < 4) {
33959
+ validate59.errors = [{ instancePath: instancePath + "/secret", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/secret/minLength", keyword: "minLength", params: { limit: 4 }, message: "must NOT have fewer than 4 characters" }];
33960
+ return false;
33961
+ } else {
33962
+ if (!pattern34.test(data10)) {
33963
+ validate59.errors = [{ instancePath: instancePath + "/secret", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/secret/pattern", keyword: "pattern", params: { pattern: "^sk_[\\x21-\\x7e]+(?: [\\x21-\\x7e]+)*$" }, message: 'must match pattern "^sk_[\\x21-\\x7e]+(?: [\\x21-\\x7e]+)*$"' }];
33964
+ return false;
33965
+ }
33966
+ }
33967
+ }
33968
+ } else {
33969
+ validate59.errors = [{ instancePath: instancePath + "/secret", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/properties/secret/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
33970
+ return false;
33971
+ }
33972
+ }
33973
+ var valid1 = _errs32 === errors;
33974
+ } else {
33975
+ var valid1 = true;
33976
+ }
33977
+ }
33978
+ }
33979
+ }
33980
+ } else {
33981
+ validate59.errors = [{ instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyMintResponse/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
33982
+ return false;
33983
+ }
33984
+ }
33985
+ validate59.errors = vErrors;
33986
+ return errors === 0;
33987
+ }
33988
+ validate59.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
33989
+ function validate60(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
33990
+ ;
33991
+ let vErrors = null;
33992
+ let errors = 0;
33993
+ const evaluated0 = validate60.evaluated;
33994
+ if (evaluated0.dynamicProps) {
33995
+ evaluated0.props = void 0;
33996
+ }
33997
+ if (evaluated0.dynamicItems) {
33998
+ evaluated0.items = void 0;
33999
+ }
34000
+ const _errs0 = errors;
34001
+ if (errors === _errs0) {
34002
+ if (data && typeof data == "object" && !Array.isArray(data)) {
34003
+ let missing0;
34004
+ if (data.requestId === void 0 && (missing0 = "requestId")) {
34005
+ validate60.errors = [{ instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyRevokeRequest/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
34006
+ return false;
34007
+ } else {
34008
+ const _errs2 = errors;
34009
+ for (const key0 in data) {
34010
+ if (!(key0 === "requestId")) {
34011
+ validate60.errors = [{ instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyRevokeRequest/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }];
34012
+ return false;
34013
+ break;
34014
+ }
34015
+ }
34016
+ if (_errs2 === errors) {
34017
+ if (data.requestId !== void 0) {
34018
+ let data0 = data.requestId;
34019
+ const _errs3 = errors;
34020
+ if (errors === _errs3) {
34021
+ if (typeof data0 === "string") {
34022
+ if (!pattern17.test(data0)) {
34023
+ validate60.errors = [{ instancePath: instancePath + "/requestId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyRevokeRequest/properties/requestId/pattern", keyword: "pattern", params: { pattern: "^[a-f0-9]{64}$" }, message: 'must match pattern "^[a-f0-9]{64}$"' }];
34024
+ return false;
34025
+ }
34026
+ } else {
34027
+ validate60.errors = [{ instancePath: instancePath + "/requestId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyRevokeRequest/properties/requestId/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
34028
+ return false;
34029
+ }
34030
+ }
34031
+ }
34032
+ }
34033
+ }
34034
+ } else {
34035
+ validate60.errors = [{ instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyRevokeRequest/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
34036
+ return false;
34037
+ }
34038
+ }
34039
+ validate60.errors = vErrors;
34040
+ return errors === 0;
34041
+ }
34042
+ validate60.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
34043
+ function validate61(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
34044
+ ;
34045
+ let vErrors = null;
34046
+ let errors = 0;
34047
+ const evaluated0 = validate61.evaluated;
34048
+ if (evaluated0.dynamicProps) {
34049
+ evaluated0.props = void 0;
34050
+ }
34051
+ if (evaluated0.dynamicItems) {
34052
+ evaluated0.items = void 0;
34053
+ }
34054
+ const _errs0 = errors;
34055
+ if (errors === _errs0) {
34056
+ if (data && typeof data == "object" && !Array.isArray(data)) {
34057
+ let missing0;
34058
+ if (data.apiKeyId === void 0 && (missing0 = "apiKeyId") || data.revoked === void 0 && (missing0 = "revoked")) {
34059
+ validate61.errors = [{ instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyRevokeResponse/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
34060
+ return false;
34061
+ } else {
34062
+ const _errs2 = errors;
34063
+ for (const key0 in data) {
34064
+ if (!(key0 === "apiKeyId" || key0 === "revoked")) {
34065
+ validate61.errors = [{ instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyRevokeResponse/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }];
34066
+ return false;
34067
+ break;
34068
+ }
34069
+ }
34070
+ if (_errs2 === errors) {
34071
+ if (data.apiKeyId !== void 0) {
34072
+ let data0 = data.apiKeyId;
34073
+ const _errs3 = errors;
34074
+ if (errors === _errs3) {
34075
+ if (typeof data0 === "string") {
34076
+ if (func1(data0) > 256) {
34077
+ validate61.errors = [{ instancePath: instancePath + "/apiKeyId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyRevokeResponse/properties/apiKeyId/maxLength", keyword: "maxLength", params: { limit: 256 }, message: "must NOT have more than 256 characters" }];
34078
+ return false;
34079
+ } else {
34080
+ if (func1(data0) < 9) {
34081
+ validate61.errors = [{ instancePath: instancePath + "/apiKeyId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyRevokeResponse/properties/apiKeyId/minLength", keyword: "minLength", params: { limit: 9 }, message: "must NOT have fewer than 9 characters" }];
34082
+ return false;
34083
+ } else {
34084
+ if (!pattern18.test(data0)) {
34085
+ validate61.errors = [{ instancePath: instancePath + "/apiKeyId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyRevokeResponse/properties/apiKeyId/pattern", keyword: "pattern", params: { pattern: "^api_key_[A-Za-z0-9_-]+$" }, message: 'must match pattern "^api_key_[A-Za-z0-9_-]+$"' }];
34086
+ return false;
34087
+ }
34088
+ }
34089
+ }
34090
+ } else {
34091
+ validate61.errors = [{ instancePath: instancePath + "/apiKeyId", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyRevokeResponse/properties/apiKeyId/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
34092
+ return false;
34093
+ }
34094
+ }
34095
+ var valid1 = _errs3 === errors;
34096
+ } else {
34097
+ var valid1 = true;
34098
+ }
34099
+ if (valid1) {
34100
+ if (data.revoked !== void 0) {
34101
+ let data1 = data.revoked;
34102
+ const _errs5 = errors;
34103
+ if (typeof data1 !== "boolean") {
34104
+ validate61.errors = [{ instancePath: instancePath + "/revoked", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyRevokeResponse/properties/revoked/type", keyword: "type", params: { type: "boolean" }, message: "must be boolean" }];
34105
+ return false;
34106
+ }
34107
+ if (true !== data1) {
34108
+ validate61.errors = [{ instancePath: instancePath + "/revoked", schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyRevokeResponse/properties/revoked/const", keyword: "const", params: { allowedValue: true }, message: "must be equal to constant" }];
34109
+ return false;
34110
+ }
34111
+ var valid1 = _errs5 === errors;
34112
+ } else {
34113
+ var valid1 = true;
34114
+ }
34115
+ }
34116
+ }
34117
+ }
34118
+ } else {
34119
+ validate61.errors = [{ instancePath, schemaPath: "https://api.getprimitive.ai/contracts/cli-http-v1.schema.json#/$defs/UserApiKeyRevokeResponse/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
34120
+ return false;
34121
+ }
34122
+ }
34123
+ validate61.errors = vErrors;
34124
+ return errors === 0;
34125
+ }
34126
+ validate61.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
34127
+
34128
+ // src/contract/cli-http-v1.ts
34129
+ function isGitHubInstallIntentStatusResponse(value) {
34130
+ if (!isGitHubInstallIntentStatusResponseStructure(value)) {
34131
+ return false;
34132
+ }
34133
+ switch (value.status) {
34134
+ case "claimed":
34135
+ return value.leaseExpiresAt <= value.expiresAt;
34136
+ case "consumed":
34137
+ return value.repositoryCount === value.adminRepositoryCount + value.nonAdminRepositoryCount && value.completedAt <= value.expiresAt;
34138
+ case "expired":
34139
+ return value.closedAt >= value.expiresAt;
34140
+ case "cancelled":
34141
+ return value.closedAt <= value.expiresAt;
34142
+ case "failed_terminal":
34143
+ return value.failureCode === "claim_lease_expired" || value.closedAt <= value.expiresAt;
34144
+ case "pending":
34145
+ return true;
34146
+ }
34147
+ }
34148
+
34149
+ // src/lib/github-install-intent.ts
34150
+ var PROTOCOL_VERSION = 1;
34151
+ var MODE = "install_intent_v1";
32175
34152
  var START_PATH = "/api/cli/github/install-intents";
32176
34153
  var POLL_REQUEST_TIMEOUT_MS2 = 1e4;
32177
34154
  var MAX_INTENT_LIFETIME_MS = 15 * 6e4;
32178
34155
  var MAX_SERVER_CLOCK_AHEAD_MS = 3e4;
32179
- var REPOSITORY_IDENTITY_MIGRATION_REQUIRED = "repository_identity_migration_required";
32180
- function isRepositoryIdentityMigrationRequiredStatus(value) {
32181
- if (typeof value !== "object" || value === null || Array.isArray(value)) {
32182
- return false;
32183
- }
32184
- const record2 = value;
32185
- if (record2.failureCode !== REPOSITORY_IDENTITY_MIGRATION_REQUIRED) {
32186
- return false;
34156
+ var GITHUB_INSTALL_INTENT_RATE_LIMITED = "github_install_intent_rate_limited";
34157
+ var HTTP_CONFLICT = 409;
34158
+ var GitHubInstallIntentRateLimitedError = class extends Error {
34159
+ code = GITHUB_INSTALL_INTENT_RATE_LIMITED;
34160
+ retryAt;
34161
+ constructor(retryAt) {
34162
+ super("GitHub connection is temporarily rate limited");
34163
+ this.name = "GitHubInstallIntentRateLimitedError";
34164
+ this.retryAt = retryAt;
32187
34165
  }
32188
- return isGitHubInstallIntentStatusResponse({
32189
- ...record2,
32190
- failureCode: "proof_commit_failed"
32191
- });
32192
- }
34166
+ };
32193
34167
  function parseGitHubInstallIntentStart(value, now = Date.now()) {
32194
34168
  if (!isGitHubInstallIntentStartResponse(value) || value.expiresAt <= now || value.expiresAt - now > MAX_INTENT_LIFETIME_MS + MAX_SERVER_CLOCK_AHEAD_MS) {
32195
34169
  return null;
32196
34170
  }
32197
34171
  return value;
32198
34172
  }
32199
- function parseGitHubInstallIntentStatus(value, expectedExpiresAt) {
32200
- if (isGitHubInstallIntentStatusResponse(value)) {
32201
- return value.expiresAt === expectedExpiresAt ? value : null;
34173
+ function parseGitHubInstallIntentRateLimit(value, now = Date.now()) {
34174
+ if (!isGitHubInstallIntentStartErrorResponse(value) || value.error !== GITHUB_INSTALL_INTENT_RATE_LIMITED || value.retryAt <= now || value.retryAt - now > MAX_INTENT_LIFETIME_MS + MAX_SERVER_CLOCK_AHEAD_MS) {
34175
+ return null;
32202
34176
  }
32203
- if (!isRepositoryIdentityMigrationRequiredStatus(value) || value.expiresAt !== expectedExpiresAt) {
34177
+ return value;
34178
+ }
34179
+ function parseGitHubInstallIntentStatus(value, expectedExpiresAt) {
34180
+ if (!isGitHubInstallIntentStatusResponse(value) || value.expiresAt !== expectedExpiresAt) {
32204
34181
  return null;
32205
34182
  }
32206
34183
  return value;
32207
34184
  }
32208
34185
  async function createGitHubInstallIntent(client, options = {}) {
32209
34186
  const { now = Date.now, ...requestOptions } = options;
32210
- const raw = await client.post(START_PATH, void 0, requestOptions);
34187
+ let raw;
34188
+ try {
34189
+ raw = await client.post(START_PATH, void 0, requestOptions);
34190
+ } catch (error) {
34191
+ const rateLimit = error instanceof HttpError && error.status === HTTP_CONFLICT ? parseGitHubInstallIntentRateLimit(error.body, now()) : null;
34192
+ if (rateLimit) throw new GitHubInstallIntentRateLimitedError(rateLimit.retryAt);
34193
+ throw error;
34194
+ }
32211
34195
  const parsed = parseGitHubInstallIntentStart(raw, now());
32212
34196
  if (!parsed) throw new Error("server returned an invalid GitHub install-intent response");
32213
34197
  return parsed;
@@ -33184,7 +35168,29 @@ var defaultDependencies2 = {
33184
35168
  function errorMessage(error) {
33185
35169
  return error instanceof Error ? error.message : String(error);
33186
35170
  }
35171
+ function rateLimitMessage(retryAt) {
35172
+ return [
35173
+ "GitHub connection is temporarily busy.",
35174
+ "Finish any GitHub authorization already open, then run `prim github connect` again after",
35175
+ `${new Date(retryAt).toISOString()}.`
35176
+ ].join(" ");
35177
+ }
33187
35178
  function reportConnectFailure(error) {
35179
+ if (error instanceof GitHubInstallIntentRateLimitedError) {
35180
+ const message2 = rateLimitMessage(error.retryAt);
35181
+ process.stderr.write(`[prim] github connect failed: ${message2}
35182
+ `);
35183
+ printJson({
35184
+ status: "error",
35185
+ error: message2,
35186
+ code: error.code,
35187
+ retryAt: error.retryAt,
35188
+ retryCommand: "prim github connect",
35189
+ resume: "Finish any GitHub authorization already open, then retry."
35190
+ });
35191
+ process.exitCode = EXIT_FAILURE;
35192
+ return;
35193
+ }
33188
35194
  const message = errorMessage(error);
33189
35195
  const human = boundedHealthError(message) ?? "unknown error";
33190
35196
  process.stderr.write(`[prim] github connect failed: ${human}
@@ -33216,6 +35222,11 @@ function reportBinding(binding, installAttempted = false) {
33216
35222
  }
33217
35223
  function terminalInstallError(status) {
33218
35224
  if (status.status === "failed_terminal") {
35225
+ if (status.failureCode === "repository_identity_migration_required") {
35226
+ return new Error(
35227
+ "Selected repos include an older Primitive connection needing a one-time repair; none changed. In GitHub App settings, exclude that existing repo to connect others, or retry after repair. If it persists, contact an admin or support."
35228
+ );
35229
+ }
33219
35230
  return new Error(`GitHub installation failed: ${status.failureCode}`);
33220
35231
  }
33221
35232
  return new Error(`GitHub installation ${status.status}`);