@rentnerproxy/app-contracts 0.0.0-stage → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +39 -2
  3. package/contracts.schema.json +4007 -0
  4. package/dist/Types/contract.types.d.ts +15 -0
  5. package/dist/Types/contract.types.js +1 -0
  6. package/dist/catalog.d.ts +352 -0
  7. package/dist/catalog.js +54 -0
  8. package/dist/client.d.ts +31 -0
  9. package/dist/client.js +66 -0
  10. package/dist/http-operations.d.ts +333 -0
  11. package/dist/http-operations.generated.d.ts +299 -0
  12. package/dist/http-operations.generated.js +300 -0
  13. package/dist/http-operations.js +17 -0
  14. package/dist/http.d.ts +127 -0
  15. package/dist/http.js +142 -0
  16. package/dist/index.d.ts +5 -0
  17. package/dist/index.js +4 -0
  18. package/dist/manifest.d.ts +90 -0
  19. package/dist/manifest.js +106 -0
  20. package/dist/platform-api.d.ts +282 -0
  21. package/dist/platform-api.js +287 -0
  22. package/dist/primitives.d.ts +33 -0
  23. package/dist/primitives.js +87 -0
  24. package/dist/provider-api.d.ts +221 -0
  25. package/dist/provider-api.js +227 -0
  26. package/dist/public-schemas.d.ts +4 -0
  27. package/dist/public-schemas.js +6 -0
  28. package/dist/publication.d.ts +410 -0
  29. package/dist/publication.js +50 -0
  30. package/dist/runtime.d.ts +75 -0
  31. package/dist/runtime.js +88 -0
  32. package/dist/schemas.d.ts +926 -0
  33. package/dist/schemas.js +114 -0
  34. package/dist/ui-bridge.d.ts +81 -0
  35. package/dist/ui-bridge.js +92 -0
  36. package/dist/validation.d.ts +784 -0
  37. package/dist/validation.js +245 -0
  38. package/dist/wire.d.ts +31 -0
  39. package/dist/wire.js +54 -0
  40. package/fixtures.json +1094 -0
  41. package/http-fixtures.json +829 -0
  42. package/openapi.json +2557 -0
  43. package/package.json +60 -5
  44. package/protocol-fixtures.json +1804 -0
  45. package/upstream-probe-fixtures.json +852 -0
@@ -0,0 +1,50 @@
1
+ import { z } from 'zod';
2
+ import { catalogRelease } from './catalog.js';
3
+ import { archive, commit, formatVersion, githubId, positiveInteger, recordId, sourceIdentity, timestamp, } from './primitives.js';
4
+ const workflowRun = z.strictObject({
5
+ repositoryId: githubId,
6
+ workflowCommit: commit,
7
+ workflowPath: z
8
+ .string()
9
+ .max(160)
10
+ .regex(/^\.github\/workflows\/[a-zA-Z0-9_-]+\.ya?ml$/),
11
+ runId: githubId,
12
+ attempt: positiveInteger,
13
+ });
14
+ export const candidate = z
15
+ .strictObject({
16
+ formatVersion,
17
+ id: recordId,
18
+ revision: positiveInteger,
19
+ source: sourceIdentity,
20
+ build: workflowRun,
21
+ evidence: z.strictObject({
22
+ revision: positiveInteger,
23
+ report: archive,
24
+ result: z.literal('passed'),
25
+ }),
26
+ release: catalogRelease,
27
+ })
28
+ .describe('Private candidate snapshot. The validation report and each target archive have their own byte identity. A record claiming success does not establish trusted validation evidence.');
29
+ export const approval = z
30
+ .strictObject({
31
+ formatVersion,
32
+ id: recordId,
33
+ revision: positiveInteger,
34
+ actorId: recordId,
35
+ approvedAt: timestamp,
36
+ candidate,
37
+ })
38
+ .describe('Private approval for the entire candidate snapshot, including ordered arrays. Resolve actor permissions and current approval state at the trusted publication boundary.');
39
+ export const publication = z
40
+ .strictObject({
41
+ formatVersion,
42
+ id: recordId,
43
+ approvalId: recordId,
44
+ approvalRevision: positiveInteger,
45
+ catalogRevision: positiveInteger,
46
+ publishedAt: timestamp,
47
+ run: workflowRun,
48
+ release: catalogRelease,
49
+ })
50
+ .describe('Private publication receipt. Reconcile by immutable approval revision and exact release contents. Record publication only after the unchanged package bytes and matching signed catalog are available.');
@@ -0,0 +1,75 @@
1
+ import { z } from 'zod';
2
+ export declare const runtimeSchemas: {
3
+ RecordId: z.ZodString;
4
+ Generation: z.ZodNumber;
5
+ BootstrapDescriptor: z.ZodObject<{
6
+ appId: z.ZodString;
7
+ installationId: z.ZodString;
8
+ generation: z.ZodNumber;
9
+ formatVersion: z.ZodLiteral<1>;
10
+ runtimeProfile: z.ZodLiteral<"rentnerproxy-linux-v1">;
11
+ versions: z.ZodObject<{
12
+ appProtocol: z.ZodLiteral<"1.0.0">;
13
+ platformApi: z.ZodLiteral<"1.0.0">;
14
+ uiBridge: z.ZodOptional<z.ZodLiteral<"1.0.0">>;
15
+ }, z.core.$strict>;
16
+ appSocket: z.ZodString;
17
+ coreSocket: z.ZodString;
18
+ appCredential: z.ZodString;
19
+ coreCredential: z.ZodString;
20
+ }, z.core.$strict>;
21
+ AppHealth: z.ZodObject<{
22
+ healthy: z.ZodLiteral<true>;
23
+ }, z.core.$loose>;
24
+ AppReadiness: z.ZodObject<{
25
+ ready: z.ZodLiteral<true>;
26
+ protocolVersion: z.ZodLiteral<"1.0.0">;
27
+ dataVersion: z.ZodOptional<z.ZodNumber>;
28
+ providers: z.ZodArray<z.ZodObject<{
29
+ id: z.ZodString;
30
+ profile: z.ZodEnum<{
31
+ crowdsec: "crowdsec";
32
+ dns: "dns";
33
+ "docker-discovery": "docker-discovery";
34
+ "load-balancer": "load-balancer";
35
+ monitoring: "monitoring";
36
+ oidc: "oidc";
37
+ }>;
38
+ version: z.ZodLiteral<"1.0.0">;
39
+ }, z.core.$strict>>;
40
+ }, z.core.$loose>;
41
+ PlatformContext: z.ZodObject<{
42
+ appId: z.ZodString;
43
+ installationId: z.ZodString;
44
+ generation: z.ZodNumber;
45
+ runtimeProfile: z.ZodLiteral<"rentnerproxy-linux-v1">;
46
+ versions: z.ZodObject<{
47
+ appProtocol: z.ZodLiteral<"1.0.0">;
48
+ platformApi: z.ZodLiteral<"1.0.0">;
49
+ uiBridge: z.ZodOptional<z.ZodLiteral<"1.0.0">>;
50
+ }, z.core.$strict>;
51
+ capabilities: z.ZodArray<z.ZodUnion<z.ZodObject<{
52
+ id: z.ZodLiteral<"access.logs.read.v1" | "diagnostics.upstream.probe.v1" | "diagnostics.upstream.probe.v2" | "dns.challenge.manage.v1" | "docker.inventory.observe.v1" | "engine.contributions.submit.v1" | "identity.provider.register.v1" | "notifications.incidents.manage.v1" | "notifications.publish.v1" | "proxy.hosts.manage-owned.v1" | "proxy.hosts.read.v1" | "security.enforcement.contribute.v1">;
53
+ scope: z.ZodLiteral<"dnsZones" | "dockerConnections" | "identityProviders" | "installation" | "ownedEngineResources" | "ownedProxyHosts" | "proxyHosts">;
54
+ }, z.core.$strict>[]>>;
55
+ }, z.core.$loose>;
56
+ AuthorizationRequest: z.ZodObject<{
57
+ capability: z.ZodUnion<z.ZodObject<{
58
+ id: z.ZodLiteral<"access.logs.read.v1" | "diagnostics.upstream.probe.v1" | "diagnostics.upstream.probe.v2" | "dns.challenge.manage.v1" | "docker.inventory.observe.v1" | "engine.contributions.submit.v1" | "identity.provider.register.v1" | "notifications.incidents.manage.v1" | "notifications.publish.v1" | "proxy.hosts.manage-owned.v1" | "proxy.hosts.read.v1" | "security.enforcement.contribute.v1">;
59
+ scope: z.ZodLiteral<"dnsZones" | "dockerConnections" | "identityProviders" | "installation" | "ownedEngineResources" | "ownedProxyHosts" | "proxyHosts">;
60
+ }, z.core.$strict>[]>;
61
+ resourceId: z.ZodString;
62
+ }, z.core.$strict>;
63
+ AuthorizationResult: z.ZodObject<{
64
+ allowed: z.ZodBoolean;
65
+ }, z.core.$loose>;
66
+ EventCursor: z.ZodString;
67
+ PlatformEvent: z.ZodObject<{
68
+ id: z.ZodString;
69
+ cursor: z.ZodString;
70
+ type: z.ZodString;
71
+ occurredAt: z.ZodISODateTime;
72
+ resourceId: z.ZodOptional<z.ZodString>;
73
+ revision: z.ZodOptional<z.ZodString>;
74
+ }, z.core.$loose>;
75
+ };
@@ -0,0 +1,88 @@
1
+ import { z } from 'zod';
2
+ import { capabilityRequest } from './manifest.js';
3
+ import { appId, formatVersion, positiveInteger, protocolVersion, recordId, runtimeProfile, stateVersion, timestamp, } from './primitives.js';
4
+ import { providerSchemas } from './provider-api.js';
5
+ const socketCredential = z
6
+ .string()
7
+ .regex(/^[a-zA-Z0-9_-]{32,128}$/)
8
+ .describe('Opaque credential issued for one socket direction and installation generation.');
9
+ function socketPath(name) {
10
+ const directory = '/[a-zA-Z0-9_-]+(?:\\.[a-zA-Z0-9_-]+)*';
11
+ return z
12
+ .string()
13
+ .max(107)
14
+ .regex(new RegExp('^(?:' + directory + ')+/' + name + '\\.sock$'));
15
+ }
16
+ const versions = z.strictObject({
17
+ appProtocol: protocolVersion,
18
+ platformApi: protocolVersion,
19
+ uiBridge: protocolVersion.optional(),
20
+ });
21
+ const installation = {
22
+ appId,
23
+ installationId: recordId,
24
+ generation: positiveInteger,
25
+ };
26
+ const bootstrapDescriptor = z
27
+ .strictObject({
28
+ formatVersion,
29
+ ...installation,
30
+ runtimeProfile,
31
+ versions,
32
+ appSocket: socketPath('app'),
33
+ coreSocket: socketPath('core'),
34
+ appCredential: socketCredential,
35
+ coreCredential: socketCredential,
36
+ })
37
+ .refine(({ appCredential, coreCredential }) => appCredential !== coreCredential, 'Socket credentials must be distinct.')
38
+ .describe('The manager hands this descriptor to the restricted app process through a private inherited file descriptor. The SDK rejects reuse of a credential across socket directions. Keep the descriptor and credentials out of command lines, process environments, browser messages, and logs. The manager verifies socket ownership and the private run directory.');
39
+ const appHealth = z.looseObject({ healthy: z.literal(true) });
40
+ const appReadiness = z
41
+ .looseObject({
42
+ ready: z.literal(true),
43
+ protocolVersion,
44
+ dataVersion: stateVersion.optional(),
45
+ providers: z.array(providerSchemas.ProviderRegistration).max(32),
46
+ })
47
+ .refine(({ providers }) => new Set(providers.map(({ id }) => id)).size === providers.length, 'Provider registration IDs must be unique.')
48
+ .describe('An absent dataVersion denotes an app without persisted data. The SDK checks unique provider registration IDs. Advertised providers become live only after the manager activates this generation.');
49
+ const platformContext = z
50
+ .looseObject({
51
+ ...installation,
52
+ runtimeProfile,
53
+ versions,
54
+ capabilities: z.array(capabilityRequest).max(32),
55
+ })
56
+ .describe('The platform derives this context from the authenticated installation. For each operation the platform rechecks current grants, actor permissions, resource scope, and generation.');
57
+ const authorizationRequest = z
58
+ .strictObject({ capability: capabilityRequest, resourceId: recordId })
59
+ .describe('Check a specific capability and resource. For installation scope resourceId is the verified installation ID. The platform derives actor identity from its issued delegation.');
60
+ const authorizationResult = z
61
+ .looseObject({ allowed: z.boolean() })
62
+ .describe('A point-in-time check. Mutating operations authorize the actor and resource again.');
63
+ const eventCursor = z
64
+ .string()
65
+ .regex(/^[a-zA-Z0-9_-]{1,256}$/)
66
+ .describe('Opaque resume cursor. Reconnect with the cursor from the last processed event.');
67
+ const platformEvent = z
68
+ .looseObject({
69
+ id: recordId,
70
+ cursor: eventCursor,
71
+ type: z.string().regex(/^[a-z][a-zA-Z0-9]{0,63}$/),
72
+ occurredAt: timestamp,
73
+ resourceId: recordId.optional(),
74
+ revision: recordId.optional(),
75
+ })
76
+ .describe('Durable authorized event data delivered at least once. Deduplicate by id. An absent resourceId or revision means the event carries no corresponding resource or revision.');
77
+ export const runtimeSchemas = {
78
+ RecordId: recordId,
79
+ Generation: positiveInteger,
80
+ BootstrapDescriptor: bootstrapDescriptor,
81
+ AppHealth: appHealth,
82
+ AppReadiness: appReadiness,
83
+ PlatformContext: platformContext,
84
+ AuthorizationRequest: authorizationRequest,
85
+ AuthorizationResult: authorizationResult,
86
+ EventCursor: eventCursor,
87
+ PlatformEvent: platformEvent,
88
+ };