@qlever-llc/trellis 0.10.5 → 0.10.8

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.
Files changed (113) hide show
  1. package/esm/auth/protocol.d.ts +120 -3
  2. package/esm/auth/protocol.d.ts.map +1 -1
  3. package/esm/auth/protocol.js +43 -1
  4. package/esm/generated-sdk/auth/client.d.ts +137 -76
  5. package/esm/generated-sdk/auth/client.d.ts.map +1 -1
  6. package/esm/generated-sdk/auth/contract.d.ts +1 -1
  7. package/esm/generated-sdk/auth/contract.d.ts.map +1 -1
  8. package/esm/generated-sdk/auth/contract.js +2 -2
  9. package/esm/generated-sdk/auth/mod.d.ts +1 -1
  10. package/esm/generated-sdk/auth/mod.d.ts.map +1 -1
  11. package/esm/generated-sdk/auth/schemas.d.ts +329 -2
  12. package/esm/generated-sdk/auth/schemas.d.ts.map +1 -1
  13. package/esm/generated-sdk/auth/schemas.js +3 -3
  14. package/esm/generated-sdk/auth/types.d.ts +47 -3
  15. package/esm/generated-sdk/auth/types.d.ts.map +1 -1
  16. package/esm/generated-sdk/auth/types.js +1 -1
  17. package/esm/generated-sdk/health/client.d.ts +27 -4
  18. package/esm/generated-sdk/health/client.d.ts.map +1 -1
  19. package/esm/generated-sdk/health/mod.d.ts +1 -1
  20. package/esm/generated-sdk/health/mod.d.ts.map +1 -1
  21. package/esm/generated-sdk/jobs/client.d.ts +38 -15
  22. package/esm/generated-sdk/jobs/client.d.ts.map +1 -1
  23. package/esm/generated-sdk/jobs/mod.d.ts +1 -1
  24. package/esm/generated-sdk/jobs/mod.d.ts.map +1 -1
  25. package/esm/generated-sdk/state/client.d.ts +36 -13
  26. package/esm/generated-sdk/state/client.d.ts.map +1 -1
  27. package/esm/generated-sdk/state/mod.d.ts +1 -1
  28. package/esm/generated-sdk/state/mod.d.ts.map +1 -1
  29. package/esm/generated-sdk/trellis-core/client.d.ts +17 -7
  30. package/esm/generated-sdk/trellis-core/client.d.ts.map +1 -1
  31. package/esm/generated-sdk/trellis-core/mod.d.ts +1 -1
  32. package/esm/generated-sdk/trellis-core/mod.d.ts.map +1 -1
  33. package/esm/index.d.ts +1 -1
  34. package/esm/index.d.ts.map +1 -1
  35. package/esm/server/service.d.ts +80 -2
  36. package/esm/server/service.d.ts.map +1 -1
  37. package/esm/server/service.js +100 -3
  38. package/esm/service/deno.d.ts +1 -1
  39. package/esm/service/deno.d.ts.map +1 -1
  40. package/esm/service/mod.d.ts +1 -1
  41. package/esm/service/mod.d.ts.map +1 -1
  42. package/esm/service/node.d.ts +1 -1
  43. package/esm/service/node.d.ts.map +1 -1
  44. package/esm/trellis.d.ts +17 -2
  45. package/esm/trellis.d.ts.map +1 -1
  46. package/esm/trellis.js +39 -3
  47. package/package.json +2 -2
  48. package/script/auth/protocol.d.ts +120 -3
  49. package/script/auth/protocol.d.ts.map +1 -1
  50. package/script/auth/protocol.js +47 -5
  51. package/script/generated-sdk/auth/client.d.ts +137 -76
  52. package/script/generated-sdk/auth/client.d.ts.map +1 -1
  53. package/script/generated-sdk/auth/contract.d.ts +1 -1
  54. package/script/generated-sdk/auth/contract.d.ts.map +1 -1
  55. package/script/generated-sdk/auth/contract.js +2 -2
  56. package/script/generated-sdk/auth/mod.d.ts +1 -1
  57. package/script/generated-sdk/auth/mod.d.ts.map +1 -1
  58. package/script/generated-sdk/auth/schemas.d.ts +329 -2
  59. package/script/generated-sdk/auth/schemas.d.ts.map +1 -1
  60. package/script/generated-sdk/auth/schemas.js +3 -3
  61. package/script/generated-sdk/auth/types.d.ts +47 -3
  62. package/script/generated-sdk/auth/types.d.ts.map +1 -1
  63. package/script/generated-sdk/auth/types.js +1 -1
  64. package/script/generated-sdk/health/client.d.ts +27 -4
  65. package/script/generated-sdk/health/client.d.ts.map +1 -1
  66. package/script/generated-sdk/health/mod.d.ts +1 -1
  67. package/script/generated-sdk/health/mod.d.ts.map +1 -1
  68. package/script/generated-sdk/jobs/client.d.ts +38 -15
  69. package/script/generated-sdk/jobs/client.d.ts.map +1 -1
  70. package/script/generated-sdk/jobs/mod.d.ts +1 -1
  71. package/script/generated-sdk/jobs/mod.d.ts.map +1 -1
  72. package/script/generated-sdk/state/client.d.ts +36 -13
  73. package/script/generated-sdk/state/client.d.ts.map +1 -1
  74. package/script/generated-sdk/state/mod.d.ts +1 -1
  75. package/script/generated-sdk/state/mod.d.ts.map +1 -1
  76. package/script/generated-sdk/trellis-core/client.d.ts +17 -7
  77. package/script/generated-sdk/trellis-core/client.d.ts.map +1 -1
  78. package/script/generated-sdk/trellis-core/mod.d.ts +1 -1
  79. package/script/generated-sdk/trellis-core/mod.d.ts.map +1 -1
  80. package/script/index.d.ts +1 -1
  81. package/script/index.d.ts.map +1 -1
  82. package/script/server/service.d.ts +80 -2
  83. package/script/server/service.d.ts.map +1 -1
  84. package/script/server/service.js +99 -2
  85. package/script/service/deno.d.ts +1 -1
  86. package/script/service/deno.d.ts.map +1 -1
  87. package/script/service/mod.d.ts +1 -1
  88. package/script/service/mod.d.ts.map +1 -1
  89. package/script/service/node.d.ts +1 -1
  90. package/script/service/node.d.ts.map +1 -1
  91. package/script/trellis.d.ts +17 -2
  92. package/script/trellis.d.ts.map +1 -1
  93. package/script/trellis.js +39 -3
  94. package/src/auth/protocol.ts +55 -1
  95. package/src/index.ts +1 -0
  96. package/src/sdk/_generated/auth/client.ts +100 -72
  97. package/src/sdk/_generated/auth/contract.ts +2 -2
  98. package/src/sdk/_generated/auth/mod.ts +1 -1
  99. package/src/sdk/_generated/auth/schemas.ts +3 -3
  100. package/src/sdk/_generated/auth/types.ts +4 -4
  101. package/src/sdk/_generated/core/client.ts +25 -8
  102. package/src/sdk/_generated/core/mod.ts +1 -1
  103. package/src/sdk/_generated/health/client.ts +26 -5
  104. package/src/sdk/_generated/health/mod.ts +1 -1
  105. package/src/sdk/_generated/jobs/client.ts +35 -14
  106. package/src/sdk/_generated/jobs/mod.ts +1 -1
  107. package/src/sdk/_generated/state/client.ts +33 -12
  108. package/src/sdk/_generated/state/mod.ts +1 -1
  109. package/src/server/service.ts +485 -2
  110. package/src/service/deno.ts +1 -0
  111. package/src/service/mod.ts +1 -0
  112. package/src/service/node.ts +1 -0
  113. package/src/trellis.ts +80 -5
@@ -2,6 +2,6 @@ export { API, OWNED_API } from "./api.js";
2
2
  export type { Api, ApiViews, OwnedApi } from "./api.js";
3
3
  export * from "./types.js";
4
4
  export * from "./schemas.js";
5
- export type { Client, HandlerClient, TrellisAuthClient, TrellisAuthState } from "./client.js";
5
+ export type { Client, HandlerClient, Service, ServiceEventSurface, ServiceHandle, ServiceWithDeps, TrellisAuthClient, TrellisAuthState } from "./client.js";
6
6
  export type { AuthDeviceUserAuthoritiesResolveOperation, AuthDeviceUserAuthoritiesResolveOperationRef, AuthDeviceUserAuthoritiesResolveTerminal } from "./client.js";
7
7
  export { CONTRACT, CONTRACT_DIGEST, CONTRACT_ID, use, sdk } from "./contract.js";
@@ -1,7 +1,7 @@
1
1
  // Generated from ./generated/contracts/manifests/trellis.auth@v1.json
2
2
  export const AuthCapabilitiesListRequestSchema = {"properties":{"limit":{"maximum":500,"minimum":0,"type":"integer"},"offset":{"minimum":0,"type":"integer"}},"required":["limit"],"type":"object"} as const;
3
3
 
4
- export const AuthCapabilitiesListResponseSchema = {"properties":{"count":{"minimum":0,"type":"integer"},"entries":{"default":[],"items":{"properties":{"consequence":{"minLength":1,"type":"string"},"contractDigest":{"pattern":"^[A-Za-z0-9_-]+$","type":"string"},"contractDisplayName":{"minLength":1,"type":"string"},"contractId":{"minLength":1,"type":"string"},"description":{"minLength":1,"type":"string"},"displayName":{"minLength":1,"type":"string"},"key":{"minLength":1,"type":"string"},"source":{"anyOf":[{"const":"contract","type":"string"},{"const":"platform","type":"string"}]}},"required":["key","displayName","description","source"],"type":"object"},"type":"array"},"limit":{"minimum":0,"type":"integer"},"nextOffset":{"minimum":0,"type":"integer"},"offset":{"minimum":0,"type":"integer"}},"required":["entries","count","offset","limit"],"type":"object"} as const;
4
+ export const AuthCapabilitiesListResponseSchema = {"properties":{"count":{"minimum":0,"type":"integer"},"entries":{"default":[],"items":{"properties":{"consequence":{"minLength":1,"type":"string"},"contractDigest":{"pattern":"^[A-Za-z0-9_-]+$","type":"string"},"contractDisplayName":{"minLength":1,"type":"string"},"contractId":{"minLength":1,"type":"string"},"deploymentId":{"minLength":1,"type":"string"},"description":{"minLength":1,"type":"string"},"direction":{"anyOf":[{"const":"creates","type":"string"},{"const":"given","type":"string"}]},"displayName":{"minLength":1,"type":"string"},"key":{"minLength":1,"type":"string"},"source":{"anyOf":[{"const":"contract","type":"string"},{"const":"platform","type":"string"}]}},"required":["key","displayName","description","source"],"type":"object"},"type":"array"},"limit":{"minimum":0,"type":"integer"},"nextOffset":{"minimum":0,"type":"integer"},"offset":{"minimum":0,"type":"integer"}},"required":["entries","count","offset","limit"],"type":"object"} as const;
5
5
 
6
6
  export const AuthCapabilityGroupsDeleteRequestSchema = {"properties":{"groupKey":{"minLength":1,"type":"string"}},"required":["groupKey"],"type":"object"} as const;
7
7
 
@@ -45,7 +45,7 @@ export const AuthDeploymentAuthorityAcceptUpdateRequestSchema = {"properties":{"
45
45
 
46
46
  export const AuthDeploymentAuthorityGetRequestSchema = {"properties":{"deploymentId":{"minLength":1,"type":"string"}},"required":["deploymentId"],"type":"object"} as const;
47
47
 
48
- export const AuthDeploymentAuthorityGetResponseSchema = {"properties":{"authority":{"properties":{"createdAt":{"format":"date-time","type":"string"},"deploymentId":{"minLength":1,"type":"string"},"desiredState":{"properties":{"capabilities":{"items":{"minLength":1,"type":"string"},"type":"array"},"needs":{"items":{"anyOf":[{"properties":{"contractId":{"minLength":1,"type":"string"},"kind":{"const":"contract","type":"string"},"required":{"type":"boolean"}},"required":["kind","contractId","required"],"type":"object"},{"properties":{"kind":{"const":"surface","type":"string"},"required":{"type":"boolean"},"surface":{"properties":{"action":{"anyOf":[{"const":"call","type":"string"},{"const":"publish","type":"string"},{"const":"subscribe","type":"string"},{"const":"observe","type":"string"},{"const":"cancel","type":"string"}]},"contractId":{"minLength":1,"type":"string"},"kind":{"anyOf":[{"const":"rpc","type":"string"},{"const":"operation","type":"string"},{"const":"event","type":"string"},{"const":"feed","type":"string"}]},"name":{"minLength":1,"type":"string"}},"required":["contractId","kind","name"],"type":"object"}},"required":["kind","surface","required"],"type":"object"},{"properties":{"capability":{"minLength":1,"type":"string"},"kind":{"const":"capability","type":"string"},"required":{"type":"boolean"}},"required":["kind","capability","required"],"type":"object"},{"properties":{"kind":{"const":"resource","type":"string"},"required":{"type":"boolean"},"resource":{"properties":{"alias":{"minLength":1,"type":"string"},"definition":{"type":"object"},"kind":{"anyOf":[{"const":"kv","type":"string"},{"const":"store","type":"string"},{"const":"jobs","type":"string"},{"const":"event-consumer","type":"string"},{"const":"transfer","type":"string"}]},"required":{"type":"boolean"}},"required":["kind","alias","required"],"type":"object"}},"required":["kind","resource","required"],"type":"object"}]},"type":"array"},"resources":{"items":{"properties":{"alias":{"minLength":1,"type":"string"},"definition":{"type":"object"},"kind":{"anyOf":[{"const":"kv","type":"string"},{"const":"store","type":"string"},{"const":"jobs","type":"string"},{"const":"event-consumer","type":"string"},{"const":"transfer","type":"string"}]},"required":{"type":"boolean"}},"required":["kind","alias","required"],"type":"object"},"type":"array"},"surfaces":{"items":{"properties":{"action":{"anyOf":[{"const":"call","type":"string"},{"const":"publish","type":"string"},{"const":"subscribe","type":"string"},{"const":"observe","type":"string"},{"const":"cancel","type":"string"}]},"contractId":{"minLength":1,"type":"string"},"kind":{"anyOf":[{"const":"rpc","type":"string"},{"const":"operation","type":"string"},{"const":"event","type":"string"},{"const":"feed","type":"string"}]},"name":{"minLength":1,"type":"string"}},"required":["contractId","kind","name"],"type":"object"},"type":"array"}},"required":["needs","capabilities","resources","surfaces"],"type":"object"},"disabled":{"type":"boolean"},"kind":{"anyOf":[{"const":"service","type":"string"},{"const":"device","type":"string"},{"const":"app","type":"string"},{"const":"cli","type":"string"},{"const":"native","type":"string"},{"const":"device-user","type":"string"}]},"updatedAt":{"format":"date-time","type":"string"},"version":{"minLength":1,"type":"string"}},"required":["deploymentId","kind","disabled","desiredState","version","createdAt","updatedAt"],"type":"object"},"grantOverrides":{"items":{"anyOf":[{"properties":{"capability":{"minLength":1,"type":"string"},"capabilityGroupKey":{"type":"null"},"contractId":{"minLength":1,"type":"string"},"deploymentId":{"minLength":1,"type":"string"},"grantKind":{"const":"capability","type":"string"},"identityKind":{"const":"web","type":"string"},"origin":{"minLength":1,"type":"string"},"sessionPublicKey":{"type":"null"}},"required":["deploymentId","identityKind","grantKind","contractId","origin","sessionPublicKey","capability","capabilityGroupKey"],"type":"object"},{"properties":{"capability":{"type":"null"},"capabilityGroupKey":{"minLength":1,"type":"string"},"contractId":{"minLength":1,"type":"string"},"deploymentId":{"minLength":1,"type":"string"},"grantKind":{"const":"capability-group","type":"string"},"identityKind":{"const":"web","type":"string"},"origin":{"minLength":1,"type":"string"},"sessionPublicKey":{"type":"null"}},"required":["deploymentId","identityKind","grantKind","contractId","origin","sessionPublicKey","capability","capabilityGroupKey"],"type":"object"},{"properties":{"capability":{"minLength":1,"type":"string"},"capabilityGroupKey":{"type":"null"},"contractId":{"minLength":1,"type":"string"},"deploymentId":{"minLength":1,"type":"string"},"grantKind":{"const":"capability","type":"string"},"identityKind":{"const":"session","type":"string"},"origin":{"type":"null"},"sessionPublicKey":{"minLength":1,"type":"string"}},"required":["deploymentId","identityKind","grantKind","contractId","origin","sessionPublicKey","capability","capabilityGroupKey"],"type":"object"},{"properties":{"capability":{"type":"null"},"capabilityGroupKey":{"minLength":1,"type":"string"},"contractId":{"minLength":1,"type":"string"},"deploymentId":{"minLength":1,"type":"string"},"grantKind":{"const":"capability-group","type":"string"},"identityKind":{"const":"session","type":"string"},"origin":{"type":"null"},"sessionPublicKey":{"minLength":1,"type":"string"}},"required":["deploymentId","identityKind","grantKind","contractId","origin","sessionPublicKey","capability","capabilityGroupKey"],"type":"object"}]},"type":"array"},"materializedAuthority":{"anyOf":[{"properties":{"deploymentId":{"minLength":1,"type":"string"},"desiredVersion":{"minLength":1,"type":"string"},"error":{"minLength":1,"type":"string"},"grants":{"items":{"type":"object"},"type":"array"},"reconciledAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"resourceBindings":{"items":{"properties":{"alias":{"minLength":1,"type":"string"},"binding":{"patternProperties":{"^.*$":{}},"type":"object"},"createdAt":{"format":"date-time","type":"string"},"deploymentId":{"minLength":1,"type":"string"},"kind":{"anyOf":[{"const":"kv","type":"string"},{"const":"store","type":"string"},{"const":"jobs","type":"string"},{"const":"event-consumer","type":"string"},{"const":"transfer","type":"string"}]},"limits":{"anyOf":[{"patternProperties":{"^.*$":{}},"type":"object"},{"type":"null"}]},"updatedAt":{"format":"date-time","type":"string"}},"required":["deploymentId","kind","alias","binding","limits","createdAt","updatedAt"],"type":"object"},"type":"array"},"status":{"anyOf":[{"const":"current","type":"string"},{"const":"pending","type":"string"},{"const":"failed","type":"string"}]}},"required":["deploymentId","desiredVersion","status","resourceBindings","grants","reconciledAt"],"type":"object"},{"type":"null"}]},"portalRoute":{"anyOf":[{"properties":{"deploymentId":{"minLength":1,"type":"string"},"disabled":{"type":"boolean"},"entryUrl":{"anyOf":[{"minLength":1,"type":"string"},{"type":"null"}]},"portalId":{"anyOf":[{"minLength":1,"type":"string"},{"type":"null"}]},"updatedAt":{"format":"date-time","type":"string"}},"required":["deploymentId","portalId","entryUrl","disabled","updatedAt"],"type":"object"},{"type":"null"}]}},"required":["authority","materializedAuthority","portalRoute","grantOverrides"],"type":"object"} as const;
48
+ export const AuthDeploymentAuthorityGetResponseSchema = {"properties":{"authority":{"properties":{"createdAt":{"format":"date-time","type":"string"},"deploymentId":{"minLength":1,"type":"string"},"desiredState":{"properties":{"capabilities":{"items":{"minLength":1,"type":"string"},"type":"array"},"needs":{"items":{"anyOf":[{"properties":{"contractId":{"minLength":1,"type":"string"},"kind":{"const":"contract","type":"string"},"required":{"type":"boolean"}},"required":["kind","contractId","required"],"type":"object"},{"properties":{"kind":{"const":"surface","type":"string"},"required":{"type":"boolean"},"surface":{"properties":{"action":{"anyOf":[{"const":"call","type":"string"},{"const":"publish","type":"string"},{"const":"subscribe","type":"string"},{"const":"observe","type":"string"},{"const":"cancel","type":"string"}]},"contractId":{"minLength":1,"type":"string"},"kind":{"anyOf":[{"const":"rpc","type":"string"},{"const":"operation","type":"string"},{"const":"event","type":"string"},{"const":"feed","type":"string"}]},"name":{"minLength":1,"type":"string"}},"required":["contractId","kind","name"],"type":"object"}},"required":["kind","surface","required"],"type":"object"},{"properties":{"capability":{"minLength":1,"type":"string"},"kind":{"const":"capability","type":"string"},"required":{"type":"boolean"}},"required":["kind","capability","required"],"type":"object"},{"properties":{"kind":{"const":"resource","type":"string"},"required":{"type":"boolean"},"resource":{"properties":{"alias":{"minLength":1,"type":"string"},"definition":{"type":"object"},"kind":{"anyOf":[{"const":"kv","type":"string"},{"const":"store","type":"string"},{"const":"jobs","type":"string"},{"const":"event-consumer","type":"string"},{"const":"transfer","type":"string"}]},"required":{"type":"boolean"}},"required":["kind","alias","required"],"type":"object"}},"required":["kind","resource","required"],"type":"object"}]},"type":"array"},"resources":{"items":{"properties":{"alias":{"minLength":1,"type":"string"},"definition":{"type":"object"},"kind":{"anyOf":[{"const":"kv","type":"string"},{"const":"store","type":"string"},{"const":"jobs","type":"string"},{"const":"event-consumer","type":"string"},{"const":"transfer","type":"string"}]},"required":{"type":"boolean"}},"required":["kind","alias","required"],"type":"object"},"type":"array"},"surfaces":{"items":{"properties":{"action":{"anyOf":[{"const":"call","type":"string"},{"const":"publish","type":"string"},{"const":"subscribe","type":"string"},{"const":"observe","type":"string"},{"const":"cancel","type":"string"}]},"contractId":{"minLength":1,"type":"string"},"kind":{"anyOf":[{"const":"rpc","type":"string"},{"const":"operation","type":"string"},{"const":"event","type":"string"},{"const":"feed","type":"string"}]},"name":{"minLength":1,"type":"string"}},"required":["contractId","kind","name"],"type":"object"},"type":"array"}},"required":["needs","capabilities","resources","surfaces"],"type":"object"},"disabled":{"type":"boolean"},"kind":{"anyOf":[{"const":"service","type":"string"},{"const":"device","type":"string"},{"const":"app","type":"string"},{"const":"cli","type":"string"},{"const":"native","type":"string"},{"const":"device-user","type":"string"}]},"updatedAt":{"format":"date-time","type":"string"},"version":{"minLength":1,"type":"string"}},"required":["deploymentId","kind","disabled","desiredState","version","createdAt","updatedAt"],"type":"object"},"grantOverrides":{"items":{"anyOf":[{"properties":{"capability":{"minLength":1,"type":"string"},"capabilityGroupKey":{"type":"null"},"contractId":{"minLength":1,"type":"string"},"deploymentId":{"minLength":1,"type":"string"},"grantKind":{"const":"capability","type":"string"},"identityKind":{"const":"web","type":"string"},"origin":{"minLength":1,"type":"string"},"sessionPublicKey":{"type":"null"}},"required":["deploymentId","identityKind","grantKind","contractId","origin","sessionPublicKey","capability","capabilityGroupKey"],"type":"object"},{"properties":{"capability":{"type":"null"},"capabilityGroupKey":{"minLength":1,"type":"string"},"contractId":{"minLength":1,"type":"string"},"deploymentId":{"minLength":1,"type":"string"},"grantKind":{"const":"capability-group","type":"string"},"identityKind":{"const":"web","type":"string"},"origin":{"minLength":1,"type":"string"},"sessionPublicKey":{"type":"null"}},"required":["deploymentId","identityKind","grantKind","contractId","origin","sessionPublicKey","capability","capabilityGroupKey"],"type":"object"},{"properties":{"capability":{"minLength":1,"type":"string"},"capabilityGroupKey":{"type":"null"},"contractId":{"minLength":1,"type":"string"},"deploymentId":{"minLength":1,"type":"string"},"grantKind":{"const":"capability","type":"string"},"identityKind":{"const":"session","type":"string"},"origin":{"type":"null"},"sessionPublicKey":{"minLength":1,"type":"string"}},"required":["deploymentId","identityKind","grantKind","contractId","origin","sessionPublicKey","capability","capabilityGroupKey"],"type":"object"},{"properties":{"capability":{"type":"null"},"capabilityGroupKey":{"minLength":1,"type":"string"},"contractId":{"minLength":1,"type":"string"},"deploymentId":{"minLength":1,"type":"string"},"grantKind":{"const":"capability-group","type":"string"},"identityKind":{"const":"session","type":"string"},"origin":{"type":"null"},"sessionPublicKey":{"minLength":1,"type":"string"}},"required":["deploymentId","identityKind","grantKind","contractId","origin","sessionPublicKey","capability","capabilityGroupKey"],"type":"object"}]},"type":"array"},"materializedAuthority":{"anyOf":[{"properties":{"deploymentId":{"minLength":1,"type":"string"},"desiredVersion":{"minLength":1,"type":"string"},"error":{"minLength":1,"type":"string"},"grants":{"items":{"anyOf":[{"properties":{"capability":{"minLength":1,"type":"string"},"kind":{"const":"capability","type":"string"}},"required":["kind","capability"],"type":"object"},{"properties":{"action":{"anyOf":[{"const":"call","type":"string"},{"const":"publish","type":"string"},{"const":"subscribe","type":"string"},{"const":"observe","type":"string"},{"const":"cancel","type":"string"}]},"contractId":{"minLength":1,"type":"string"},"kind":{"const":"surface","type":"string"},"name":{"minLength":1,"type":"string"},"surfaceKind":{"anyOf":[{"const":"rpc","type":"string"},{"const":"operation","type":"string"},{"const":"event","type":"string"},{"const":"feed","type":"string"}]}},"required":["kind","contractId","surfaceKind","name"],"type":"object"},{"properties":{"direction":{"anyOf":[{"const":"publish","type":"string"},{"const":"subscribe","type":"string"}]},"grantSource":{"anyOf":[{"const":"owned-surface","type":"string"},{"const":"used-surface","type":"string"},{"const":"resource-binding","type":"string"},{"const":"platform-service","type":"string"},{"const":"transfer","type":"string"}]},"kind":{"const":"nats","type":"string"},"requiredCapabilities":{"items":{"minLength":1,"type":"string"},"type":"array"},"subject":{"minLength":1,"type":"string"},"surface":{"properties":{"action":{"anyOf":[{"const":"call","type":"string"},{"const":"publish","type":"string"},{"const":"subscribe","type":"string"},{"const":"observe","type":"string"},{"const":"cancel","type":"string"}]},"contractId":{"minLength":1,"type":"string"},"kind":{"anyOf":[{"const":"rpc","type":"string"},{"const":"operation","type":"string"},{"const":"event","type":"string"},{"const":"feed","type":"string"}]},"name":{"minLength":1,"type":"string"}},"required":["contractId","kind","name"],"type":"object"}},"required":["kind","direction","subject","requiredCapabilities","grantSource"],"type":"object"}]},"type":"array"},"reconciledAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"resourceBindings":{"items":{"properties":{"alias":{"minLength":1,"type":"string"},"binding":{"patternProperties":{"^.*$":{}},"type":"object"},"createdAt":{"format":"date-time","type":"string"},"deploymentId":{"minLength":1,"type":"string"},"kind":{"anyOf":[{"const":"kv","type":"string"},{"const":"store","type":"string"},{"const":"jobs","type":"string"},{"const":"event-consumer","type":"string"},{"const":"transfer","type":"string"}]},"limits":{"anyOf":[{"patternProperties":{"^.*$":{}},"type":"object"},{"type":"null"}]},"updatedAt":{"format":"date-time","type":"string"}},"required":["deploymentId","kind","alias","binding","limits","createdAt","updatedAt"],"type":"object"},"type":"array"},"status":{"anyOf":[{"const":"current","type":"string"},{"const":"pending","type":"string"},{"const":"failed","type":"string"}]}},"required":["deploymentId","desiredVersion","status","resourceBindings","grants","reconciledAt"],"type":"object"},{"type":"null"}]},"portalRoute":{"anyOf":[{"properties":{"deploymentId":{"minLength":1,"type":"string"},"disabled":{"type":"boolean"},"entryUrl":{"anyOf":[{"minLength":1,"type":"string"},{"type":"null"}]},"portalId":{"anyOf":[{"minLength":1,"type":"string"},{"type":"null"}]},"updatedAt":{"format":"date-time","type":"string"}},"required":["deploymentId","portalId","entryUrl","disabled","updatedAt"],"type":"object"},{"type":"null"}]}},"required":["authority","materializedAuthority","portalRoute","grantOverrides"],"type":"object"} as const;
49
49
 
50
50
  export const AuthDeploymentAuthorityGrantOverridesListRequestSchema = {"properties":{"limit":{"maximum":500,"minimum":0,"type":"integer"},"offset":{"minimum":0,"type":"integer"}},"required":["limit"],"type":"object"} as const;
51
51
 
@@ -75,7 +75,7 @@ export const AuthDeploymentAuthorityPlansListResponseSchema = {"properties":{"co
75
75
 
76
76
  export const AuthDeploymentAuthorityReconcileRequestSchema = {"properties":{"deploymentId":{"minLength":1,"type":"string"},"desiredVersion":{"minLength":1,"type":"string"}},"required":["deploymentId"],"type":"object"} as const;
77
77
 
78
- export const AuthDeploymentAuthorityReconcileResponseSchema = {"properties":{"authority":{"properties":{"createdAt":{"format":"date-time","type":"string"},"deploymentId":{"minLength":1,"type":"string"},"desiredState":{"properties":{"capabilities":{"items":{"minLength":1,"type":"string"},"type":"array"},"needs":{"items":{"anyOf":[{"properties":{"contractId":{"minLength":1,"type":"string"},"kind":{"const":"contract","type":"string"},"required":{"type":"boolean"}},"required":["kind","contractId","required"],"type":"object"},{"properties":{"kind":{"const":"surface","type":"string"},"required":{"type":"boolean"},"surface":{"properties":{"action":{"anyOf":[{"const":"call","type":"string"},{"const":"publish","type":"string"},{"const":"subscribe","type":"string"},{"const":"observe","type":"string"},{"const":"cancel","type":"string"}]},"contractId":{"minLength":1,"type":"string"},"kind":{"anyOf":[{"const":"rpc","type":"string"},{"const":"operation","type":"string"},{"const":"event","type":"string"},{"const":"feed","type":"string"}]},"name":{"minLength":1,"type":"string"}},"required":["contractId","kind","name"],"type":"object"}},"required":["kind","surface","required"],"type":"object"},{"properties":{"capability":{"minLength":1,"type":"string"},"kind":{"const":"capability","type":"string"},"required":{"type":"boolean"}},"required":["kind","capability","required"],"type":"object"},{"properties":{"kind":{"const":"resource","type":"string"},"required":{"type":"boolean"},"resource":{"properties":{"alias":{"minLength":1,"type":"string"},"definition":{"type":"object"},"kind":{"anyOf":[{"const":"kv","type":"string"},{"const":"store","type":"string"},{"const":"jobs","type":"string"},{"const":"event-consumer","type":"string"},{"const":"transfer","type":"string"}]},"required":{"type":"boolean"}},"required":["kind","alias","required"],"type":"object"}},"required":["kind","resource","required"],"type":"object"}]},"type":"array"},"resources":{"items":{"properties":{"alias":{"minLength":1,"type":"string"},"definition":{"type":"object"},"kind":{"anyOf":[{"const":"kv","type":"string"},{"const":"store","type":"string"},{"const":"jobs","type":"string"},{"const":"event-consumer","type":"string"},{"const":"transfer","type":"string"}]},"required":{"type":"boolean"}},"required":["kind","alias","required"],"type":"object"},"type":"array"},"surfaces":{"items":{"properties":{"action":{"anyOf":[{"const":"call","type":"string"},{"const":"publish","type":"string"},{"const":"subscribe","type":"string"},{"const":"observe","type":"string"},{"const":"cancel","type":"string"}]},"contractId":{"minLength":1,"type":"string"},"kind":{"anyOf":[{"const":"rpc","type":"string"},{"const":"operation","type":"string"},{"const":"event","type":"string"},{"const":"feed","type":"string"}]},"name":{"minLength":1,"type":"string"}},"required":["contractId","kind","name"],"type":"object"},"type":"array"}},"required":["needs","capabilities","resources","surfaces"],"type":"object"},"disabled":{"type":"boolean"},"kind":{"anyOf":[{"const":"service","type":"string"},{"const":"device","type":"string"},{"const":"app","type":"string"},{"const":"cli","type":"string"},{"const":"native","type":"string"},{"const":"device-user","type":"string"}]},"updatedAt":{"format":"date-time","type":"string"},"version":{"minLength":1,"type":"string"}},"required":["deploymentId","kind","disabled","desiredState","version","createdAt","updatedAt"],"type":"object"},"materializedAuthority":{"properties":{"deploymentId":{"minLength":1,"type":"string"},"desiredVersion":{"minLength":1,"type":"string"},"error":{"minLength":1,"type":"string"},"grants":{"items":{"type":"object"},"type":"array"},"reconciledAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"resourceBindings":{"items":{"properties":{"alias":{"minLength":1,"type":"string"},"binding":{"patternProperties":{"^.*$":{}},"type":"object"},"createdAt":{"format":"date-time","type":"string"},"deploymentId":{"minLength":1,"type":"string"},"kind":{"anyOf":[{"const":"kv","type":"string"},{"const":"store","type":"string"},{"const":"jobs","type":"string"},{"const":"event-consumer","type":"string"},{"const":"transfer","type":"string"}]},"limits":{"anyOf":[{"patternProperties":{"^.*$":{}},"type":"object"},{"type":"null"}]},"updatedAt":{"format":"date-time","type":"string"}},"required":["deploymentId","kind","alias","binding","limits","createdAt","updatedAt"],"type":"object"},"type":"array"},"status":{"anyOf":[{"const":"current","type":"string"},{"const":"pending","type":"string"},{"const":"failed","type":"string"}]}},"required":["deploymentId","desiredVersion","status","resourceBindings","grants","reconciledAt"],"type":"object"},"reconciliation":{"properties":{"deploymentId":{"minLength":1,"type":"string"},"desiredVersion":{"minLength":1,"type":"string"},"finishedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"message":{"minLength":1,"type":"string"},"startedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"state":{"anyOf":[{"const":"idle","type":"string"},{"const":"running","type":"string"},{"const":"succeeded","type":"string"},{"const":"failed","type":"string"}]}},"required":["deploymentId","desiredVersion","state","startedAt","finishedAt"],"type":"object"}},"required":["authority","materializedAuthority"],"type":"object"} as const;
78
+ export const AuthDeploymentAuthorityReconcileResponseSchema = {"properties":{"authority":{"properties":{"createdAt":{"format":"date-time","type":"string"},"deploymentId":{"minLength":1,"type":"string"},"desiredState":{"properties":{"capabilities":{"items":{"minLength":1,"type":"string"},"type":"array"},"needs":{"items":{"anyOf":[{"properties":{"contractId":{"minLength":1,"type":"string"},"kind":{"const":"contract","type":"string"},"required":{"type":"boolean"}},"required":["kind","contractId","required"],"type":"object"},{"properties":{"kind":{"const":"surface","type":"string"},"required":{"type":"boolean"},"surface":{"properties":{"action":{"anyOf":[{"const":"call","type":"string"},{"const":"publish","type":"string"},{"const":"subscribe","type":"string"},{"const":"observe","type":"string"},{"const":"cancel","type":"string"}]},"contractId":{"minLength":1,"type":"string"},"kind":{"anyOf":[{"const":"rpc","type":"string"},{"const":"operation","type":"string"},{"const":"event","type":"string"},{"const":"feed","type":"string"}]},"name":{"minLength":1,"type":"string"}},"required":["contractId","kind","name"],"type":"object"}},"required":["kind","surface","required"],"type":"object"},{"properties":{"capability":{"minLength":1,"type":"string"},"kind":{"const":"capability","type":"string"},"required":{"type":"boolean"}},"required":["kind","capability","required"],"type":"object"},{"properties":{"kind":{"const":"resource","type":"string"},"required":{"type":"boolean"},"resource":{"properties":{"alias":{"minLength":1,"type":"string"},"definition":{"type":"object"},"kind":{"anyOf":[{"const":"kv","type":"string"},{"const":"store","type":"string"},{"const":"jobs","type":"string"},{"const":"event-consumer","type":"string"},{"const":"transfer","type":"string"}]},"required":{"type":"boolean"}},"required":["kind","alias","required"],"type":"object"}},"required":["kind","resource","required"],"type":"object"}]},"type":"array"},"resources":{"items":{"properties":{"alias":{"minLength":1,"type":"string"},"definition":{"type":"object"},"kind":{"anyOf":[{"const":"kv","type":"string"},{"const":"store","type":"string"},{"const":"jobs","type":"string"},{"const":"event-consumer","type":"string"},{"const":"transfer","type":"string"}]},"required":{"type":"boolean"}},"required":["kind","alias","required"],"type":"object"},"type":"array"},"surfaces":{"items":{"properties":{"action":{"anyOf":[{"const":"call","type":"string"},{"const":"publish","type":"string"},{"const":"subscribe","type":"string"},{"const":"observe","type":"string"},{"const":"cancel","type":"string"}]},"contractId":{"minLength":1,"type":"string"},"kind":{"anyOf":[{"const":"rpc","type":"string"},{"const":"operation","type":"string"},{"const":"event","type":"string"},{"const":"feed","type":"string"}]},"name":{"minLength":1,"type":"string"}},"required":["contractId","kind","name"],"type":"object"},"type":"array"}},"required":["needs","capabilities","resources","surfaces"],"type":"object"},"disabled":{"type":"boolean"},"kind":{"anyOf":[{"const":"service","type":"string"},{"const":"device","type":"string"},{"const":"app","type":"string"},{"const":"cli","type":"string"},{"const":"native","type":"string"},{"const":"device-user","type":"string"}]},"updatedAt":{"format":"date-time","type":"string"},"version":{"minLength":1,"type":"string"}},"required":["deploymentId","kind","disabled","desiredState","version","createdAt","updatedAt"],"type":"object"},"materializedAuthority":{"properties":{"deploymentId":{"minLength":1,"type":"string"},"desiredVersion":{"minLength":1,"type":"string"},"error":{"minLength":1,"type":"string"},"grants":{"items":{"anyOf":[{"properties":{"capability":{"minLength":1,"type":"string"},"kind":{"const":"capability","type":"string"}},"required":["kind","capability"],"type":"object"},{"properties":{"action":{"anyOf":[{"const":"call","type":"string"},{"const":"publish","type":"string"},{"const":"subscribe","type":"string"},{"const":"observe","type":"string"},{"const":"cancel","type":"string"}]},"contractId":{"minLength":1,"type":"string"},"kind":{"const":"surface","type":"string"},"name":{"minLength":1,"type":"string"},"surfaceKind":{"anyOf":[{"const":"rpc","type":"string"},{"const":"operation","type":"string"},{"const":"event","type":"string"},{"const":"feed","type":"string"}]}},"required":["kind","contractId","surfaceKind","name"],"type":"object"},{"properties":{"direction":{"anyOf":[{"const":"publish","type":"string"},{"const":"subscribe","type":"string"}]},"grantSource":{"anyOf":[{"const":"owned-surface","type":"string"},{"const":"used-surface","type":"string"},{"const":"resource-binding","type":"string"},{"const":"platform-service","type":"string"},{"const":"transfer","type":"string"}]},"kind":{"const":"nats","type":"string"},"requiredCapabilities":{"items":{"minLength":1,"type":"string"},"type":"array"},"subject":{"minLength":1,"type":"string"},"surface":{"properties":{"action":{"anyOf":[{"const":"call","type":"string"},{"const":"publish","type":"string"},{"const":"subscribe","type":"string"},{"const":"observe","type":"string"},{"const":"cancel","type":"string"}]},"contractId":{"minLength":1,"type":"string"},"kind":{"anyOf":[{"const":"rpc","type":"string"},{"const":"operation","type":"string"},{"const":"event","type":"string"},{"const":"feed","type":"string"}]},"name":{"minLength":1,"type":"string"}},"required":["contractId","kind","name"],"type":"object"}},"required":["kind","direction","subject","requiredCapabilities","grantSource"],"type":"object"}]},"type":"array"},"reconciledAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"resourceBindings":{"items":{"properties":{"alias":{"minLength":1,"type":"string"},"binding":{"patternProperties":{"^.*$":{}},"type":"object"},"createdAt":{"format":"date-time","type":"string"},"deploymentId":{"minLength":1,"type":"string"},"kind":{"anyOf":[{"const":"kv","type":"string"},{"const":"store","type":"string"},{"const":"jobs","type":"string"},{"const":"event-consumer","type":"string"},{"const":"transfer","type":"string"}]},"limits":{"anyOf":[{"patternProperties":{"^.*$":{}},"type":"object"},{"type":"null"}]},"updatedAt":{"format":"date-time","type":"string"}},"required":["deploymentId","kind","alias","binding","limits","createdAt","updatedAt"],"type":"object"},"type":"array"},"status":{"anyOf":[{"const":"current","type":"string"},{"const":"pending","type":"string"},{"const":"failed","type":"string"}]}},"required":["deploymentId","desiredVersion","status","resourceBindings","grants","reconciledAt"],"type":"object"},"reconciliation":{"properties":{"deploymentId":{"minLength":1,"type":"string"},"desiredVersion":{"minLength":1,"type":"string"},"finishedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"message":{"minLength":1,"type":"string"},"startedAt":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}]},"state":{"anyOf":[{"const":"idle","type":"string"},{"const":"running","type":"string"},{"const":"succeeded","type":"string"},{"const":"failed","type":"string"}]}},"required":["deploymentId","desiredVersion","state","startedAt","finishedAt"],"type":"object"}},"required":["authority","materializedAuthority"],"type":"object"} as const;
79
79
 
80
80
  export const AuthDeploymentAuthorityRejectRequestSchema = {"properties":{"planId":{"minLength":1,"type":"string"},"reason":{"minLength":1,"type":"string"}},"required":["planId"],"type":"object"} as const;
81
81
 
@@ -3,10 +3,10 @@ import type { RpcHandlerFn } from "../../../index.js";
3
3
  import type { API } from "./api.js";
4
4
 
5
5
  export const CONTRACT_ID = "trellis.auth@v1" as const;
6
- export const CONTRACT_DIGEST = "gLadyuZkZX2uxa3wnVMUJkDDddoVgRrDEzH8TIdeDyw" as const;
6
+ export const CONTRACT_DIGEST = "XdqgSxkrIhWOu1ODbOk6-QHLTlI52ZP-6qhYJpIdCMc" as const;
7
7
 
8
8
  export type AuthCapabilitiesListInput = { limit: number; offset?: number; };
9
- export type AuthCapabilitiesListOutput = { count: number; entries: Array<{ consequence?: string; contractDigest?: string; contractDisplayName?: string; contractId?: string; description: string; displayName: string; key: string; source: ("contract" | "platform"); }>; limit: number; nextOffset?: number; offset: number; };
9
+ export type AuthCapabilitiesListOutput = { count: number; entries: Array<{ consequence?: string; contractDigest?: string; contractDisplayName?: string; contractId?: string; deploymentId?: string; description: string; direction?: ("creates" | "given"); displayName: string; key: string; source: ("contract" | "platform"); }>; limit: number; nextOffset?: number; offset: number; };
10
10
 
11
11
  export type AuthCapabilityGroupsDeleteInput = { groupKey: string; };
12
12
  export type AuthCapabilityGroupsDeleteOutput = { success: boolean; };
@@ -36,7 +36,7 @@ export type AuthDeploymentAuthorityAcceptUpdateInput = { expectedDesiredVersion?
36
36
  export type AuthDeploymentAuthorityAcceptUpdateOutput = { authority: { createdAt: string; deploymentId: string; desiredState: { capabilities: Array<string>; needs: Array<({ contractId: string; kind: "contract"; required: boolean; } | { kind: "surface"; required: boolean; surface: { action?: ("call" | "publish" | "subscribe" | "observe" | "cancel"); contractId: string; kind: ("rpc" | "operation" | "event" | "feed"); name: string; }; } | { capability: string; kind: "capability"; required: boolean; } | { kind: "resource"; required: boolean; resource: { alias: string; definition?: { }; kind: ("kv" | "store" | "jobs" | "event-consumer" | "transfer"); required: boolean; }; })>; resources: Array<{ alias: string; definition?: { }; kind: ("kv" | "store" | "jobs" | "event-consumer" | "transfer"); required: boolean; }>; surfaces: Array<{ action?: ("call" | "publish" | "subscribe" | "observe" | "cancel"); contractId: string; kind: ("rpc" | "operation" | "event" | "feed"); name: string; }>; }; disabled: boolean; kind: ("service" | "device" | "app" | "cli" | "native" | "device-user"); updatedAt: string; version: string; }; };
37
37
 
38
38
  export type AuthDeploymentAuthorityGetInput = { deploymentId: string; };
39
- export type AuthDeploymentAuthorityGetOutput = { authority: { createdAt: string; deploymentId: string; desiredState: { capabilities: Array<string>; needs: Array<({ contractId: string; kind: "contract"; required: boolean; } | { kind: "surface"; required: boolean; surface: { action?: ("call" | "publish" | "subscribe" | "observe" | "cancel"); contractId: string; kind: ("rpc" | "operation" | "event" | "feed"); name: string; }; } | { capability: string; kind: "capability"; required: boolean; } | { kind: "resource"; required: boolean; resource: { alias: string; definition?: { }; kind: ("kv" | "store" | "jobs" | "event-consumer" | "transfer"); required: boolean; }; })>; resources: Array<{ alias: string; definition?: { }; kind: ("kv" | "store" | "jobs" | "event-consumer" | "transfer"); required: boolean; }>; surfaces: Array<{ action?: ("call" | "publish" | "subscribe" | "observe" | "cancel"); contractId: string; kind: ("rpc" | "operation" | "event" | "feed"); name: string; }>; }; disabled: boolean; kind: ("service" | "device" | "app" | "cli" | "native" | "device-user"); updatedAt: string; version: string; }; grantOverrides: Array<({ capability: string; capabilityGroupKey: null; contractId: string; deploymentId: string; grantKind: "capability"; identityKind: "web"; origin: string; sessionPublicKey: null; } | { capability: null; capabilityGroupKey: string; contractId: string; deploymentId: string; grantKind: "capability-group"; identityKind: "web"; origin: string; sessionPublicKey: null; } | { capability: string; capabilityGroupKey: null; contractId: string; deploymentId: string; grantKind: "capability"; identityKind: "session"; origin: null; sessionPublicKey: string; } | { capability: null; capabilityGroupKey: string; contractId: string; deploymentId: string; grantKind: "capability-group"; identityKind: "session"; origin: null; sessionPublicKey: string; })>; materializedAuthority: ({ deploymentId: string; desiredVersion: string; error?: string; grants: Array<{ }>; reconciledAt: (string | null); resourceBindings: Array<{ alias: string; binding: { [k: string]: unknown; }; createdAt: string; deploymentId: string; kind: ("kv" | "store" | "jobs" | "event-consumer" | "transfer"); limits: ({ [k: string]: unknown; } | null); updatedAt: string; }>; status: ("current" | "pending" | "failed"); } | null); portalRoute: ({ deploymentId: string; disabled: boolean; entryUrl: (string | null); portalId: (string | null); updatedAt: string; } | null); };
39
+ export type AuthDeploymentAuthorityGetOutput = { authority: { createdAt: string; deploymentId: string; desiredState: { capabilities: Array<string>; needs: Array<({ contractId: string; kind: "contract"; required: boolean; } | { kind: "surface"; required: boolean; surface: { action?: ("call" | "publish" | "subscribe" | "observe" | "cancel"); contractId: string; kind: ("rpc" | "operation" | "event" | "feed"); name: string; }; } | { capability: string; kind: "capability"; required: boolean; } | { kind: "resource"; required: boolean; resource: { alias: string; definition?: { }; kind: ("kv" | "store" | "jobs" | "event-consumer" | "transfer"); required: boolean; }; })>; resources: Array<{ alias: string; definition?: { }; kind: ("kv" | "store" | "jobs" | "event-consumer" | "transfer"); required: boolean; }>; surfaces: Array<{ action?: ("call" | "publish" | "subscribe" | "observe" | "cancel"); contractId: string; kind: ("rpc" | "operation" | "event" | "feed"); name: string; }>; }; disabled: boolean; kind: ("service" | "device" | "app" | "cli" | "native" | "device-user"); updatedAt: string; version: string; }; grantOverrides: Array<({ capability: string; capabilityGroupKey: null; contractId: string; deploymentId: string; grantKind: "capability"; identityKind: "web"; origin: string; sessionPublicKey: null; } | { capability: null; capabilityGroupKey: string; contractId: string; deploymentId: string; grantKind: "capability-group"; identityKind: "web"; origin: string; sessionPublicKey: null; } | { capability: string; capabilityGroupKey: null; contractId: string; deploymentId: string; grantKind: "capability"; identityKind: "session"; origin: null; sessionPublicKey: string; } | { capability: null; capabilityGroupKey: string; contractId: string; deploymentId: string; grantKind: "capability-group"; identityKind: "session"; origin: null; sessionPublicKey: string; })>; materializedAuthority: ({ deploymentId: string; desiredVersion: string; error?: string; grants: Array<({ capability: string; kind: "capability"; } | { action?: ("call" | "publish" | "subscribe" | "observe" | "cancel"); contractId: string; kind: "surface"; name: string; surfaceKind: ("rpc" | "operation" | "event" | "feed"); } | { direction: ("publish" | "subscribe"); grantSource: ("owned-surface" | "used-surface" | "resource-binding" | "platform-service" | "transfer"); kind: "nats"; requiredCapabilities: Array<string>; subject: string; surface?: { action?: ("call" | "publish" | "subscribe" | "observe" | "cancel"); contractId: string; kind: ("rpc" | "operation" | "event" | "feed"); name: string; }; })>; reconciledAt: (string | null); resourceBindings: Array<{ alias: string; binding: { [k: string]: unknown; }; createdAt: string; deploymentId: string; kind: ("kv" | "store" | "jobs" | "event-consumer" | "transfer"); limits: ({ [k: string]: unknown; } | null); updatedAt: string; }>; status: ("current" | "pending" | "failed"); } | null); portalRoute: ({ deploymentId: string; disabled: boolean; entryUrl: (string | null); portalId: (string | null); updatedAt: string; } | null); };
40
40
 
41
41
  export type AuthDeploymentAuthorityGrantOverridesListInput = { limit: number; offset?: number; };
42
42
  export type AuthDeploymentAuthorityGrantOverridesListOutput = { count: number; entries: Array<({ capability: string; capabilityGroupKey: null; contractId: string; deploymentId: string; grantKind: "capability"; identityKind: "web"; origin: string; sessionPublicKey: null; } | { capability: null; capabilityGroupKey: string; contractId: string; deploymentId: string; grantKind: "capability-group"; identityKind: "web"; origin: string; sessionPublicKey: null; } | { capability: string; capabilityGroupKey: null; contractId: string; deploymentId: string; grantKind: "capability"; identityKind: "session"; origin: null; sessionPublicKey: string; } | { capability: null; capabilityGroupKey: string; contractId: string; deploymentId: string; grantKind: "capability-group"; identityKind: "session"; origin: null; sessionPublicKey: string; })>; limit: number; nextOffset?: number; offset: number; };
@@ -60,7 +60,7 @@ export type AuthDeploymentAuthorityPlansListInput = { classification?: ("update"
60
60
  export type AuthDeploymentAuthorityPlansListOutput = { count: number; entries: Array<({ classification: "update"; createdAt: string; decisionAt?: (string | null); decisionBy?: ({ [k: string]: unknown; } | null); decisionReason?: (string | null); deploymentId: string; desiredChange: { }; expiresAt?: string; materializationPreview: { }; planId: string; proposal: { contract?: { }; contractDigest: string; contractId: string; deploymentId: string; proposalId?: string; providedSurfaces: Array<{ action?: ("call" | "publish" | "subscribe" | "observe" | "cancel"); contractId: string; kind: ("rpc" | "operation" | "event" | "feed"); name: string; }>; requestedNeeds: Array<({ contractId: string; kind: "contract"; required: boolean; } | { kind: "surface"; required: boolean; surface: { action?: ("call" | "publish" | "subscribe" | "observe" | "cancel"); contractId: string; kind: ("rpc" | "operation" | "event" | "feed"); name: string; }; } | { capability: string; kind: "capability"; required: boolean; } | { kind: "resource"; required: boolean; resource: { alias: string; definition?: { }; kind: ("kv" | "store" | "jobs" | "event-consumer" | "transfer"); required: boolean; }; })>; summary?: { }; }; state?: ("pending" | "accepted" | "rejected" | "expired"); warnings: Array<string>; } | { acknowledgementRequired: boolean; classification: "migration"; createdAt: string; decisionAt?: (string | null); decisionBy?: ({ [k: string]: unknown; } | null); decisionReason?: (string | null); deploymentId: string; desiredChange: { }; expiresAt?: string; materializationPreview: { }; planId: string; proposal: { contract?: { }; contractDigest: string; contractId: string; deploymentId: string; proposalId?: string; providedSurfaces: Array<{ action?: ("call" | "publish" | "subscribe" | "observe" | "cancel"); contractId: string; kind: ("rpc" | "operation" | "event" | "feed"); name: string; }>; requestedNeeds: Array<({ contractId: string; kind: "contract"; required: boolean; } | { kind: "surface"; required: boolean; surface: { action?: ("call" | "publish" | "subscribe" | "observe" | "cancel"); contractId: string; kind: ("rpc" | "operation" | "event" | "feed"); name: string; }; } | { capability: string; kind: "capability"; required: boolean; } | { kind: "resource"; required: boolean; resource: { alias: string; definition?: { }; kind: ("kv" | "store" | "jobs" | "event-consumer" | "transfer"); required: boolean; }; })>; summary?: { }; }; state?: ("pending" | "accepted" | "rejected" | "expired"); warnings: Array<string>; })>; limit: number; nextOffset?: number; offset: number; };
61
61
 
62
62
  export type AuthDeploymentAuthorityReconcileInput = { deploymentId: string; desiredVersion?: string; };
63
- export type AuthDeploymentAuthorityReconcileOutput = { authority: { createdAt: string; deploymentId: string; desiredState: { capabilities: Array<string>; needs: Array<({ contractId: string; kind: "contract"; required: boolean; } | { kind: "surface"; required: boolean; surface: { action?: ("call" | "publish" | "subscribe" | "observe" | "cancel"); contractId: string; kind: ("rpc" | "operation" | "event" | "feed"); name: string; }; } | { capability: string; kind: "capability"; required: boolean; } | { kind: "resource"; required: boolean; resource: { alias: string; definition?: { }; kind: ("kv" | "store" | "jobs" | "event-consumer" | "transfer"); required: boolean; }; })>; resources: Array<{ alias: string; definition?: { }; kind: ("kv" | "store" | "jobs" | "event-consumer" | "transfer"); required: boolean; }>; surfaces: Array<{ action?: ("call" | "publish" | "subscribe" | "observe" | "cancel"); contractId: string; kind: ("rpc" | "operation" | "event" | "feed"); name: string; }>; }; disabled: boolean; kind: ("service" | "device" | "app" | "cli" | "native" | "device-user"); updatedAt: string; version: string; }; materializedAuthority: { deploymentId: string; desiredVersion: string; error?: string; grants: Array<{ }>; reconciledAt: (string | null); resourceBindings: Array<{ alias: string; binding: { [k: string]: unknown; }; createdAt: string; deploymentId: string; kind: ("kv" | "store" | "jobs" | "event-consumer" | "transfer"); limits: ({ [k: string]: unknown; } | null); updatedAt: string; }>; status: ("current" | "pending" | "failed"); }; reconciliation?: { deploymentId: string; desiredVersion: string; finishedAt: (string | null); message?: string; startedAt: (string | null); state: ("idle" | "running" | "succeeded" | "failed"); }; };
63
+ export type AuthDeploymentAuthorityReconcileOutput = { authority: { createdAt: string; deploymentId: string; desiredState: { capabilities: Array<string>; needs: Array<({ contractId: string; kind: "contract"; required: boolean; } | { kind: "surface"; required: boolean; surface: { action?: ("call" | "publish" | "subscribe" | "observe" | "cancel"); contractId: string; kind: ("rpc" | "operation" | "event" | "feed"); name: string; }; } | { capability: string; kind: "capability"; required: boolean; } | { kind: "resource"; required: boolean; resource: { alias: string; definition?: { }; kind: ("kv" | "store" | "jobs" | "event-consumer" | "transfer"); required: boolean; }; })>; resources: Array<{ alias: string; definition?: { }; kind: ("kv" | "store" | "jobs" | "event-consumer" | "transfer"); required: boolean; }>; surfaces: Array<{ action?: ("call" | "publish" | "subscribe" | "observe" | "cancel"); contractId: string; kind: ("rpc" | "operation" | "event" | "feed"); name: string; }>; }; disabled: boolean; kind: ("service" | "device" | "app" | "cli" | "native" | "device-user"); updatedAt: string; version: string; }; materializedAuthority: { deploymentId: string; desiredVersion: string; error?: string; grants: Array<({ capability: string; kind: "capability"; } | { action?: ("call" | "publish" | "subscribe" | "observe" | "cancel"); contractId: string; kind: "surface"; name: string; surfaceKind: ("rpc" | "operation" | "event" | "feed"); } | { direction: ("publish" | "subscribe"); grantSource: ("owned-surface" | "used-surface" | "resource-binding" | "platform-service" | "transfer"); kind: "nats"; requiredCapabilities: Array<string>; subject: string; surface?: { action?: ("call" | "publish" | "subscribe" | "observe" | "cancel"); contractId: string; kind: ("rpc" | "operation" | "event" | "feed"); name: string; }; })>; reconciledAt: (string | null); resourceBindings: Array<{ alias: string; binding: { [k: string]: unknown; }; createdAt: string; deploymentId: string; kind: ("kv" | "store" | "jobs" | "event-consumer" | "transfer"); limits: ({ [k: string]: unknown; } | null); updatedAt: string; }>; status: ("current" | "pending" | "failed"); }; reconciliation?: { deploymentId: string; desiredVersion: string; finishedAt: (string | null); message?: string; startedAt: (string | null); state: ("idle" | "running" | "succeeded" | "failed"); }; };
64
64
 
65
65
  export type AuthDeploymentAuthorityRejectInput = { planId: string; reason?: string; };
66
66
  export type AuthDeploymentAuthorityRejectOutput = { success: boolean; };
@@ -1,13 +1,21 @@
1
1
  // Generated from ./generated/contracts/manifests/trellis.core@v1.json
2
- import type { AcceptedOperation, AsyncResult, BaseError, EventOpts, FeedSubscribeOpts, FeedSubscription, HandlerTrellis, MapStateStoreClient, MaybeAsync, OperationInputBuilder, OperationObserverCallbacks, OperationRef, OperationRefData, OperationRuntimeHandle, PreparedTrellisEvent, ReceiveTransferGrant, ReceiveTransferHandle, RequestOpts, Result, RpcHandlerContext, SendTransferGrant, SendTransferHandle, TerminalOperation, TransferCapableOperationInputBuilder, TrellisConnection, UnexpectedError, ValidationError, ValueStateStoreClient } from "../../../index.js";
2
+ import type { AcceptedOperation, AsyncResult, BaseError, EventListenerContext, EventOpts, FeedSubscribeOpts, FeedSubscription, HandlerTrellis, MapStateStoreClient, MaybeAsync, OperationInputBuilder, OperationObserverCallbacks, OperationRef, OperationRefData, OperationRuntimeHandle, OperationTransferHandle, PreparedTrellisEvent, ReceiveTransferGrant, ReceiveTransferHandle, RequestOpts, Result, RpcHandlerContext, SendTransferGrant, SendTransferHandle, TerminalOperation, TransferCapableOperationInputBuilder, TrellisConnection, UnexpectedError, ValidationError, ValueStateStoreClient } from "../../../index.js";
3
3
  import type { API, Api } from "./api.js";
4
4
  import type * as Types from "./types.js";
5
5
 
6
+ type WithDeps<TDeps> = [TDeps] extends [undefined] ? {} : { deps: TDeps };
7
+
6
8
  type EventCallback<TMessage> = {
7
- bivarianceHack(message: TMessage): MaybeAsync<void, BaseError>;
9
+ bivarianceHack(message: TMessage, context: EventListenerContext): MaybeAsync<void, BaseError>;
8
10
  }["bivarianceHack"];
9
11
 
10
- type RpcHandler<TInput, TOutput> = (args: { input: TInput; context: RpcHandlerContext; client: HandlerClient }) => MaybeAsync<TOutput, BaseError>;
12
+ type ServiceEventHandler<TEvent, TDeps = undefined> = (args: { event: TEvent; context: EventListenerContext; client: HandlerClient } & WithDeps<TDeps>) => MaybeAsync<void, BaseError>;
13
+
14
+ type RpcHandler<TInput, TOutput, TDeps = undefined> = (args: { input: TInput; context: RpcHandlerContext; client: HandlerClient } & WithDeps<TDeps>) => MaybeAsync<TOutput, BaseError>;
15
+
16
+ type FeedHandler<TInput, TEvent, TDeps = undefined> = (context: { input: TInput; caller: unknown; signal: AbortSignal; emit(event: TEvent): AsyncResult<void, ValidationError | UnexpectedError>; client: HandlerClient } & WithDeps<TDeps>) => unknown | Promise<unknown>;
17
+
18
+ type OperationHandler<TInput, TProgress, TOutput, TTransfer, TDeps = undefined> = (context: { input: TInput; op: OperationRuntimeHandle<TProgress, TOutput>; caller: unknown; client: HandlerClient } & TTransfer & WithDeps<TDeps>) => unknown | Promise<unknown>;
11
19
 
12
20
  export type TrellisCoreState = {};
13
21
 
@@ -33,16 +41,25 @@ export interface TrellisCoreClient {
33
41
  wait(): AsyncResult<void, BaseError>;
34
42
  }
35
43
 
36
- export interface Service extends Client {
44
+ export interface Service extends TrellisCoreClient {
37
45
  readonly handle: ServiceHandle;
46
+ with<TDeps>(deps: TDeps): ServiceWithDeps<TDeps>;
38
47
  }
39
48
 
40
- export interface ServiceHandle {
49
+ export type ServiceWithDeps<TDeps> = Omit<TrellisCoreClient, "event"> & {
50
+ readonly event: ServiceEventSurface<TDeps>;
51
+ readonly handle: ServiceHandle<TDeps>;
52
+ with<TNextDeps>(deps: TNextDeps): ServiceWithDeps<TNextDeps>;
53
+ };
54
+
55
+ export type ServiceEventSurface<TDeps> = {};
56
+
57
+ export interface ServiceHandle<TDeps = undefined> {
41
58
  readonly rpc: {
42
59
  readonly trellis: {
43
- catalog(handler: RpcHandler<Types.TrellisCatalogInput, Types.TrellisCatalogOutput>): Promise<void>;
44
- contractGet(handler: RpcHandler<Types.TrellisContractGetInput, Types.TrellisContractGetOutput>): Promise<void>;
45
- surfaceStatus(handler: RpcHandler<Types.TrellisSurfaceStatusInput, Types.TrellisSurfaceStatusOutput>): Promise<void>;
60
+ catalog(handler: RpcHandler<Types.TrellisCatalogInput, Types.TrellisCatalogOutput, TDeps>): Promise<void>;
61
+ contractGet(handler: RpcHandler<Types.TrellisContractGetInput, Types.TrellisContractGetOutput, TDeps>): Promise<void>;
62
+ surfaceStatus(handler: RpcHandler<Types.TrellisSurfaceStatusInput, Types.TrellisSurfaceStatusOutput, TDeps>): Promise<void>;
46
63
  };
47
64
  };
48
65
  readonly feed: {};
@@ -2,5 +2,5 @@ export { API, OWNED_API } from "./api.js";
2
2
  export type { Api, ApiViews, OwnedApi } from "./api.js";
3
3
  export * from "./types.js";
4
4
  export * from "./schemas.js";
5
- export type { Client, HandlerClient, TrellisCoreClient, TrellisCoreState } from "./client.js";
5
+ export type { Client, HandlerClient, Service, ServiceEventSurface, ServiceHandle, ServiceWithDeps, TrellisCoreClient, TrellisCoreState } from "./client.js";
6
6
  export { CONTRACT, CONTRACT_DIGEST, CONTRACT_ID, use, sdk } from "./contract.js";
@@ -1,13 +1,21 @@
1
1
  // Generated from ./generated/contracts/manifests/trellis.health@v1.json
2
- import type { AcceptedOperation, AsyncResult, BaseError, EventOpts, FeedSubscribeOpts, FeedSubscription, HandlerTrellis, MapStateStoreClient, MaybeAsync, OperationInputBuilder, OperationObserverCallbacks, OperationRef, OperationRefData, OperationRuntimeHandle, PreparedTrellisEvent, ReceiveTransferGrant, ReceiveTransferHandle, RequestOpts, Result, RpcHandlerContext, SendTransferGrant, SendTransferHandle, TerminalOperation, TransferCapableOperationInputBuilder, TrellisConnection, UnexpectedError, ValidationError, ValueStateStoreClient } from "../../../index.js";
2
+ import type { AcceptedOperation, AsyncResult, BaseError, EventListenerContext, EventOpts, FeedSubscribeOpts, FeedSubscription, HandlerTrellis, MapStateStoreClient, MaybeAsync, OperationInputBuilder, OperationObserverCallbacks, OperationRef, OperationRefData, OperationRuntimeHandle, OperationTransferHandle, PreparedTrellisEvent, ReceiveTransferGrant, ReceiveTransferHandle, RequestOpts, Result, RpcHandlerContext, SendTransferGrant, SendTransferHandle, TerminalOperation, TransferCapableOperationInputBuilder, TrellisConnection, UnexpectedError, ValidationError, ValueStateStoreClient } from "../../../index.js";
3
3
  import type { API, Api } from "./api.js";
4
4
  import type * as Types from "./types.js";
5
5
 
6
+ type WithDeps<TDeps> = [TDeps] extends [undefined] ? {} : { deps: TDeps };
7
+
6
8
  type EventCallback<TMessage> = {
7
- bivarianceHack(message: TMessage): MaybeAsync<void, BaseError>;
9
+ bivarianceHack(message: TMessage, context: EventListenerContext): MaybeAsync<void, BaseError>;
8
10
  }["bivarianceHack"];
9
11
 
10
- type RpcHandler<TInput, TOutput> = (args: { input: TInput; context: RpcHandlerContext; client: HandlerClient }) => MaybeAsync<TOutput, BaseError>;
12
+ type ServiceEventHandler<TEvent, TDeps = undefined> = (args: { event: TEvent; context: EventListenerContext; client: HandlerClient } & WithDeps<TDeps>) => MaybeAsync<void, BaseError>;
13
+
14
+ type RpcHandler<TInput, TOutput, TDeps = undefined> = (args: { input: TInput; context: RpcHandlerContext; client: HandlerClient } & WithDeps<TDeps>) => MaybeAsync<TOutput, BaseError>;
15
+
16
+ type FeedHandler<TInput, TEvent, TDeps = undefined> = (context: { input: TInput; caller: unknown; signal: AbortSignal; emit(event: TEvent): AsyncResult<void, ValidationError | UnexpectedError>; client: HandlerClient } & WithDeps<TDeps>) => unknown | Promise<unknown>;
17
+
18
+ type OperationHandler<TInput, TProgress, TOutput, TTransfer, TDeps = undefined> = (context: { input: TInput; op: OperationRuntimeHandle<TProgress, TOutput>; caller: unknown; client: HandlerClient } & TTransfer & WithDeps<TDeps>) => unknown | Promise<unknown>;
11
19
 
12
20
  export type TrellisHealthState = {};
13
21
 
@@ -31,11 +39,24 @@ export interface TrellisHealthClient {
31
39
  wait(): AsyncResult<void, BaseError>;
32
40
  }
33
41
 
34
- export interface Service extends Client {
42
+ export interface Service extends TrellisHealthClient {
35
43
  readonly handle: ServiceHandle;
44
+ with<TDeps>(deps: TDeps): ServiceWithDeps<TDeps>;
45
+ }
46
+
47
+ export type ServiceWithDeps<TDeps> = Omit<TrellisHealthClient, "event"> & {
48
+ readonly event: ServiceEventSurface<TDeps>;
49
+ readonly handle: ServiceHandle<TDeps>;
50
+ with<TNextDeps>(deps: TNextDeps): ServiceWithDeps<TNextDeps>;
51
+ };
52
+
53
+ export interface ServiceEventSurface<TDeps> {
54
+ readonly health: {
55
+ heartbeat: { publish(event: Omit<Types.HealthHeartbeatEvent, "header">): AsyncResult<void, ValidationError | UnexpectedError>; prepare(event: Omit<Types.HealthHeartbeatEvent, "header">): Result<PreparedTrellisEvent<Omit<Types.HealthHeartbeatEvent, "header">>, ValidationError | UnexpectedError>; listen(handler: ServiceEventHandler<Types.HealthHeartbeatEvent, TDeps>, subjectData?: Record<string, unknown>, opts?: EventOpts): AsyncResult<void, ValidationError | UnexpectedError>; };
56
+ };
36
57
  }
37
58
 
38
- export interface ServiceHandle {
59
+ export interface ServiceHandle<TDeps = undefined> {
39
60
  readonly rpc: {};
40
61
  readonly feed: {};
41
62
  readonly operation: {};
@@ -2,5 +2,5 @@ export { API, OWNED_API } from "./api.js";
2
2
  export type { Api, ApiViews, OwnedApi } from "./api.js";
3
3
  export * from "./types.js";
4
4
  export * from "./schemas.js";
5
- export type { Client, HandlerClient, TrellisHealthClient, TrellisHealthState } from "./client.js";
5
+ export type { Client, HandlerClient, Service, ServiceEventSurface, ServiceHandle, ServiceWithDeps, TrellisHealthClient, TrellisHealthState } from "./client.js";
6
6
  export { CONTRACT, CONTRACT_DIGEST, CONTRACT_ID, use, sdk } from "./contract.js";
@@ -1,16 +1,24 @@
1
1
  // Generated from ./generated/contracts/manifests/trellis.jobs@v1.json
2
- import type { AcceptedOperation, AsyncResult, BaseError, EventOpts, FeedSubscribeOpts, FeedSubscription, HandlerTrellis, MapStateStoreClient, MaybeAsync, OperationInputBuilder, OperationObserverCallbacks, OperationRef, OperationRefData, OperationRuntimeHandle, PreparedTrellisEvent, ReceiveTransferGrant, ReceiveTransferHandle, RequestOpts, Result, RpcHandlerContext, SendTransferGrant, SendTransferHandle, TerminalOperation, TransferCapableOperationInputBuilder, TrellisConnection, UnexpectedError, ValidationError, ValueStateStoreClient } from "../../../index.js";
2
+ import type { AcceptedOperation, AsyncResult, BaseError, EventListenerContext, EventOpts, FeedSubscribeOpts, FeedSubscription, HandlerTrellis, MapStateStoreClient, MaybeAsync, OperationInputBuilder, OperationObserverCallbacks, OperationRef, OperationRefData, OperationRuntimeHandle, OperationTransferHandle, PreparedTrellisEvent, ReceiveTransferGrant, ReceiveTransferHandle, RequestOpts, Result, RpcHandlerContext, SendTransferGrant, SendTransferHandle, TerminalOperation, TransferCapableOperationInputBuilder, TrellisConnection, UnexpectedError, ValidationError, ValueStateStoreClient } from "../../../index.js";
3
3
  import type { API, Api } from "./api.js";
4
4
  import type * as Types from "./types.js";
5
5
  import type * as AuthSdk from "../auth/mod.js";
6
6
  import type * as CoreSdk from "../core/mod.js";
7
7
  import type * as HealthSdk from "../health/mod.js";
8
8
 
9
+ type WithDeps<TDeps> = [TDeps] extends [undefined] ? {} : { deps: TDeps };
10
+
9
11
  type EventCallback<TMessage> = {
10
- bivarianceHack(message: TMessage): MaybeAsync<void, BaseError>;
12
+ bivarianceHack(message: TMessage, context: EventListenerContext): MaybeAsync<void, BaseError>;
11
13
  }["bivarianceHack"];
12
14
 
13
- type RpcHandler<TInput, TOutput> = (args: { input: TInput; context: RpcHandlerContext; client: HandlerClient }) => MaybeAsync<TOutput, BaseError>;
15
+ type ServiceEventHandler<TEvent, TDeps = undefined> = (args: { event: TEvent; context: EventListenerContext; client: HandlerClient } & WithDeps<TDeps>) => MaybeAsync<void, BaseError>;
16
+
17
+ type RpcHandler<TInput, TOutput, TDeps = undefined> = (args: { input: TInput; context: RpcHandlerContext; client: HandlerClient } & WithDeps<TDeps>) => MaybeAsync<TOutput, BaseError>;
18
+
19
+ type FeedHandler<TInput, TEvent, TDeps = undefined> = (context: { input: TInput; caller: unknown; signal: AbortSignal; emit(event: TEvent): AsyncResult<void, ValidationError | UnexpectedError>; client: HandlerClient } & WithDeps<TDeps>) => unknown | Promise<unknown>;
20
+
21
+ type OperationHandler<TInput, TProgress, TOutput, TTransfer, TDeps = undefined> = (context: { input: TInput; op: OperationRuntimeHandle<TProgress, TOutput>; caller: unknown; client: HandlerClient } & TTransfer & WithDeps<TDeps>) => unknown | Promise<unknown>;
14
22
 
15
23
  export type TrellisJobsState = {};
16
24
 
@@ -52,22 +60,35 @@ export interface TrellisJobsClient {
52
60
  wait(): AsyncResult<void, BaseError>;
53
61
  }
54
62
 
55
- export interface Service extends Client {
63
+ export interface Service extends TrellisJobsClient {
56
64
  readonly handle: ServiceHandle;
65
+ with<TDeps>(deps: TDeps): ServiceWithDeps<TDeps>;
66
+ }
67
+
68
+ export type ServiceWithDeps<TDeps> = Omit<TrellisJobsClient, "event"> & {
69
+ readonly event: ServiceEventSurface<TDeps>;
70
+ readonly handle: ServiceHandle<TDeps>;
71
+ with<TNextDeps>(deps: TNextDeps): ServiceWithDeps<TNextDeps>;
72
+ };
73
+
74
+ export interface ServiceEventSurface<TDeps> {
75
+ readonly health: {
76
+ heartbeat: { publish(event: Omit<HealthSdk.HealthHeartbeatEvent, "header">): AsyncResult<void, ValidationError | UnexpectedError>; prepare(event: Omit<HealthSdk.HealthHeartbeatEvent, "header">): Result<PreparedTrellisEvent<Omit<HealthSdk.HealthHeartbeatEvent, "header">>, ValidationError | UnexpectedError>; listen(handler: ServiceEventHandler<HealthSdk.HealthHeartbeatEvent, TDeps>, subjectData?: Record<string, unknown>, opts?: EventOpts): AsyncResult<void, ValidationError | UnexpectedError>; };
77
+ };
57
78
  }
58
79
 
59
- export interface ServiceHandle {
80
+ export interface ServiceHandle<TDeps = undefined> {
60
81
  readonly rpc: {
61
82
  readonly jobs: {
62
- cancel(handler: RpcHandler<Types.JobsCancelInput, Types.JobsCancelOutput>): Promise<void>;
63
- dismissDLQ(handler: RpcHandler<Types.JobsDismissDLQInput, Types.JobsDismissDLQOutput>): Promise<void>;
64
- get(handler: RpcHandler<Types.JobsGetInput, Types.JobsGetOutput>): Promise<void>;
65
- health(handler: RpcHandler<Types.JobsHealthInput, Types.JobsHealthOutput>): Promise<void>;
66
- list(handler: RpcHandler<Types.JobsListInput, Types.JobsListOutput>): Promise<void>;
67
- listDLQ(handler: RpcHandler<Types.JobsListDLQInput, Types.JobsListDLQOutput>): Promise<void>;
68
- listServices(handler: RpcHandler<Types.JobsListServicesInput, Types.JobsListServicesOutput>): Promise<void>;
69
- replayDLQ(handler: RpcHandler<Types.JobsReplayDLQInput, Types.JobsReplayDLQOutput>): Promise<void>;
70
- retry(handler: RpcHandler<Types.JobsRetryInput, Types.JobsRetryOutput>): Promise<void>;
83
+ cancel(handler: RpcHandler<Types.JobsCancelInput, Types.JobsCancelOutput, TDeps>): Promise<void>;
84
+ dismissDLQ(handler: RpcHandler<Types.JobsDismissDLQInput, Types.JobsDismissDLQOutput, TDeps>): Promise<void>;
85
+ get(handler: RpcHandler<Types.JobsGetInput, Types.JobsGetOutput, TDeps>): Promise<void>;
86
+ health(handler: RpcHandler<Types.JobsHealthInput, Types.JobsHealthOutput, TDeps>): Promise<void>;
87
+ list(handler: RpcHandler<Types.JobsListInput, Types.JobsListOutput, TDeps>): Promise<void>;
88
+ listDLQ(handler: RpcHandler<Types.JobsListDLQInput, Types.JobsListDLQOutput, TDeps>): Promise<void>;
89
+ listServices(handler: RpcHandler<Types.JobsListServicesInput, Types.JobsListServicesOutput, TDeps>): Promise<void>;
90
+ replayDLQ(handler: RpcHandler<Types.JobsReplayDLQInput, Types.JobsReplayDLQOutput, TDeps>): Promise<void>;
91
+ retry(handler: RpcHandler<Types.JobsRetryInput, Types.JobsRetryOutput, TDeps>): Promise<void>;
71
92
  };
72
93
  };
73
94
  readonly feed: {};
@@ -2,5 +2,5 @@ export { API, OWNED_API } from "./api.js";
2
2
  export type { Api, ApiViews, OwnedApi } from "./api.js";
3
3
  export * from "./types.js";
4
4
  export * from "./schemas.js";
5
- export type { Client, HandlerClient, TrellisJobsClient, TrellisJobsState } from "./client.js";
5
+ export type { Client, HandlerClient, Service, ServiceEventSurface, ServiceHandle, ServiceWithDeps, TrellisJobsClient, TrellisJobsState } from "./client.js";
6
6
  export { CONTRACT, CONTRACT_DIGEST, CONTRACT_ID, use, sdk } from "./contract.js";
@@ -1,14 +1,22 @@
1
1
  // Generated from ./generated/contracts/manifests/trellis.state@v1.json
2
- import type { AcceptedOperation, AsyncResult, BaseError, EventOpts, FeedSubscribeOpts, FeedSubscription, HandlerTrellis, MapStateStoreClient, MaybeAsync, OperationInputBuilder, OperationObserverCallbacks, OperationRef, OperationRefData, OperationRuntimeHandle, PreparedTrellisEvent, ReceiveTransferGrant, ReceiveTransferHandle, RequestOpts, Result, RpcHandlerContext, SendTransferGrant, SendTransferHandle, TerminalOperation, TransferCapableOperationInputBuilder, TrellisConnection, UnexpectedError, ValidationError, ValueStateStoreClient } from "../../../index.js";
2
+ import type { AcceptedOperation, AsyncResult, BaseError, EventListenerContext, EventOpts, FeedSubscribeOpts, FeedSubscription, HandlerTrellis, MapStateStoreClient, MaybeAsync, OperationInputBuilder, OperationObserverCallbacks, OperationRef, OperationRefData, OperationRuntimeHandle, OperationTransferHandle, PreparedTrellisEvent, ReceiveTransferGrant, ReceiveTransferHandle, RequestOpts, Result, RpcHandlerContext, SendTransferGrant, SendTransferHandle, TerminalOperation, TransferCapableOperationInputBuilder, TrellisConnection, UnexpectedError, ValidationError, ValueStateStoreClient } from "../../../index.js";
3
3
  import type { API, Api } from "./api.js";
4
4
  import type * as Types from "./types.js";
5
5
  import type * as HealthSdk from "../health/mod.js";
6
6
 
7
+ type WithDeps<TDeps> = [TDeps] extends [undefined] ? {} : { deps: TDeps };
8
+
7
9
  type EventCallback<TMessage> = {
8
- bivarianceHack(message: TMessage): MaybeAsync<void, BaseError>;
10
+ bivarianceHack(message: TMessage, context: EventListenerContext): MaybeAsync<void, BaseError>;
9
11
  }["bivarianceHack"];
10
12
 
11
- type RpcHandler<TInput, TOutput> = (args: { input: TInput; context: RpcHandlerContext; client: HandlerClient }) => MaybeAsync<TOutput, BaseError>;
13
+ type ServiceEventHandler<TEvent, TDeps = undefined> = (args: { event: TEvent; context: EventListenerContext; client: HandlerClient } & WithDeps<TDeps>) => MaybeAsync<void, BaseError>;
14
+
15
+ type RpcHandler<TInput, TOutput, TDeps = undefined> = (args: { input: TInput; context: RpcHandlerContext; client: HandlerClient } & WithDeps<TDeps>) => MaybeAsync<TOutput, BaseError>;
16
+
17
+ type FeedHandler<TInput, TEvent, TDeps = undefined> = (context: { input: TInput; caller: unknown; signal: AbortSignal; emit(event: TEvent): AsyncResult<void, ValidationError | UnexpectedError>; client: HandlerClient } & WithDeps<TDeps>) => unknown | Promise<unknown>;
18
+
19
+ type OperationHandler<TInput, TProgress, TOutput, TTransfer, TDeps = undefined> = (context: { input: TInput; op: OperationRuntimeHandle<TProgress, TOutput>; caller: unknown; client: HandlerClient } & TTransfer & WithDeps<TDeps>) => unknown | Promise<unknown>;
12
20
 
13
21
  export type TrellisStateState = {};
14
22
 
@@ -42,20 +50,33 @@ export interface TrellisStateClient {
42
50
  wait(): AsyncResult<void, BaseError>;
43
51
  }
44
52
 
45
- export interface Service extends Client {
53
+ export interface Service extends TrellisStateClient {
46
54
  readonly handle: ServiceHandle;
55
+ with<TDeps>(deps: TDeps): ServiceWithDeps<TDeps>;
56
+ }
57
+
58
+ export type ServiceWithDeps<TDeps> = Omit<TrellisStateClient, "event"> & {
59
+ readonly event: ServiceEventSurface<TDeps>;
60
+ readonly handle: ServiceHandle<TDeps>;
61
+ with<TNextDeps>(deps: TNextDeps): ServiceWithDeps<TNextDeps>;
62
+ };
63
+
64
+ export interface ServiceEventSurface<TDeps> {
65
+ readonly health: {
66
+ heartbeat: { publish(event: Omit<HealthSdk.HealthHeartbeatEvent, "header">): AsyncResult<void, ValidationError | UnexpectedError>; prepare(event: Omit<HealthSdk.HealthHeartbeatEvent, "header">): Result<PreparedTrellisEvent<Omit<HealthSdk.HealthHeartbeatEvent, "header">>, ValidationError | UnexpectedError>; listen(handler: ServiceEventHandler<HealthSdk.HealthHeartbeatEvent, TDeps>, subjectData?: Record<string, unknown>, opts?: EventOpts): AsyncResult<void, ValidationError | UnexpectedError>; };
67
+ };
47
68
  }
48
69
 
49
- export interface ServiceHandle {
70
+ export interface ServiceHandle<TDeps = undefined> {
50
71
  readonly rpc: {
51
72
  readonly state: {
52
- adminDelete(handler: RpcHandler<Types.StateAdminDeleteInput, Types.StateAdminDeleteOutput>): Promise<void>;
53
- adminGet(handler: RpcHandler<Types.StateAdminGetInput, Types.StateAdminGetOutput>): Promise<void>;
54
- adminList(handler: RpcHandler<Types.StateAdminListInput, Types.StateAdminListOutput>): Promise<void>;
55
- delete(handler: RpcHandler<Types.StateDeleteInput, Types.StateDeleteOutput>): Promise<void>;
56
- get(handler: RpcHandler<Types.StateGetInput, Types.StateGetOutput>): Promise<void>;
57
- list(handler: RpcHandler<Types.StateListInput, Types.StateListOutput>): Promise<void>;
58
- put(handler: RpcHandler<Types.StatePutInput, Types.StatePutOutput>): Promise<void>;
73
+ adminDelete(handler: RpcHandler<Types.StateAdminDeleteInput, Types.StateAdminDeleteOutput, TDeps>): Promise<void>;
74
+ adminGet(handler: RpcHandler<Types.StateAdminGetInput, Types.StateAdminGetOutput, TDeps>): Promise<void>;
75
+ adminList(handler: RpcHandler<Types.StateAdminListInput, Types.StateAdminListOutput, TDeps>): Promise<void>;
76
+ delete(handler: RpcHandler<Types.StateDeleteInput, Types.StateDeleteOutput, TDeps>): Promise<void>;
77
+ get(handler: RpcHandler<Types.StateGetInput, Types.StateGetOutput, TDeps>): Promise<void>;
78
+ list(handler: RpcHandler<Types.StateListInput, Types.StateListOutput, TDeps>): Promise<void>;
79
+ put(handler: RpcHandler<Types.StatePutInput, Types.StatePutOutput, TDeps>): Promise<void>;
59
80
  };
60
81
  };
61
82
  readonly feed: {};
@@ -2,5 +2,5 @@ export { API, OWNED_API } from "./api.js";
2
2
  export type { Api, ApiViews, OwnedApi } from "./api.js";
3
3
  export * from "./types.js";
4
4
  export * from "./schemas.js";
5
- export type { Client, HandlerClient, TrellisStateClient, TrellisStateState } from "./client.js";
5
+ export type { Client, HandlerClient, Service, ServiceEventSurface, ServiceHandle, ServiceWithDeps, TrellisStateClient, TrellisStateState } from "./client.js";
6
6
  export { CONTRACT, CONTRACT_DIGEST, CONTRACT_ID, use, sdk } from "./contract.js";