@shipeasy/openapi 1.6.0 → 2.2.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 (151) hide show
  1. package/README.md +37 -0
  2. package/dist/chunk-643YSMLU.js +1616 -0
  3. package/dist/chunk-643YSMLU.js.map +1 -0
  4. package/dist/chunk-MRW3DJ57.js +3385 -0
  5. package/dist/chunk-MRW3DJ57.js.map +1 -0
  6. package/dist/client-K0ShmsC7.d.ts +11284 -0
  7. package/dist/client.d.ts +1 -0
  8. package/dist/client.js +215 -0
  9. package/dist/client.js.map +1 -0
  10. package/dist/custom.d.ts +86 -0
  11. package/dist/custom.js +300 -0
  12. package/dist/custom.js.map +1 -0
  13. package/dist/index.d.ts +29 -41
  14. package/dist/index.js +258 -4375
  15. package/dist/index.js.map +1 -0
  16. package/dist/node-context.d.ts +81 -33
  17. package/dist/node-context.js +98 -44
  18. package/dist/node-context.js.map +1 -0
  19. package/dist/schemas.d.ts +7973 -0
  20. package/dist/schemas.js +1099 -0
  21. package/dist/schemas.js.map +1 -0
  22. package/openapi.json +15922 -3232
  23. package/openapi.yaml +14277 -0
  24. package/package.json +33 -26
  25. package/spec/components/errors.yaml +53 -0
  26. package/spec/components/parameters.yaml +32 -0
  27. package/spec/components/responses.yaml +122 -0
  28. package/spec/components/schemas/alert-rules.yaml +175 -0
  29. package/spec/components/schemas/attributes.yaml +157 -0
  30. package/spec/components/schemas/common.yaml +92 -0
  31. package/spec/components/schemas/configs.yaml +371 -0
  32. package/spec/components/schemas/connectors.yaml +587 -0
  33. package/spec/components/schemas/errors-api.yaml +209 -0
  34. package/spec/components/schemas/events.yaml +321 -0
  35. package/spec/components/schemas/experiments.yaml +865 -0
  36. package/spec/components/schemas/gate-templates.yaml +237 -0
  37. package/spec/components/schemas/gates.yaml +890 -0
  38. package/spec/components/schemas/i18n.yaml +478 -0
  39. package/spec/components/schemas/keys.yaml +186 -0
  40. package/spec/components/schemas/killswitches.yaml +309 -0
  41. package/spec/components/schemas/metrics.yaml +547 -0
  42. package/spec/components/schemas/ops.yaml +1013 -0
  43. package/spec/components/schemas/projects.yaml +222 -0
  44. package/spec/components/schemas/search.yaml +46 -0
  45. package/spec/components/schemas/universes.yaml +127 -0
  46. package/spec/openapi.yaml +367 -0
  47. package/spec/paths/alert-rules.yaml +258 -0
  48. package/spec/paths/attributes.yaml +272 -0
  49. package/spec/paths/configs.yaml +758 -0
  50. package/spec/paths/connectors.yaml +782 -0
  51. package/spec/paths/errors.yaml +382 -0
  52. package/spec/paths/events.yaml +380 -0
  53. package/spec/paths/experiments.yaml +803 -0
  54. package/spec/paths/gate-templates.yaml +267 -0
  55. package/spec/paths/gates.yaml +465 -0
  56. package/spec/paths/i18n.yaml +557 -0
  57. package/spec/paths/keys.yaml +182 -0
  58. package/spec/paths/killswitches.yaml +574 -0
  59. package/spec/paths/metrics.yaml +313 -0
  60. package/spec/paths/ops.yaml +446 -0
  61. package/spec/paths/projects.yaml +210 -0
  62. package/spec/paths/search.yaml +62 -0
  63. package/spec/paths/universes.yaml +255 -0
  64. package/dist/operations/attributes.d.ts +0 -33
  65. package/dist/operations/attributes.js +0 -16
  66. package/dist/operations/cli-adapter.d.ts +0 -35
  67. package/dist/operations/cli-adapter.js +0 -91
  68. package/dist/operations/coerce.d.ts +0 -32
  69. package/dist/operations/coerce.js +0 -53
  70. package/dist/operations/configs.d.ts +0 -28
  71. package/dist/operations/configs.js +0 -119
  72. package/dist/operations/docs.d.ts +0 -37
  73. package/dist/operations/docs.js +0 -39
  74. package/dist/operations/events.d.ts +0 -28
  75. package/dist/operations/events.js +0 -121
  76. package/dist/operations/experiments.d.ts +0 -28
  77. package/dist/operations/experiments.js +0 -280
  78. package/dist/operations/gates.d.ts +0 -28
  79. package/dist/operations/gates.js +0 -132
  80. package/dist/operations/i18n.d.ts +0 -28
  81. package/dist/operations/i18n.js +0 -121
  82. package/dist/operations/index.d.ts +0 -63
  83. package/dist/operations/index.js +0 -1751
  84. package/dist/operations/killswitches.d.ts +0 -28
  85. package/dist/operations/killswitches.js +0 -126
  86. package/dist/operations/mcp-adapter.d.ts +0 -35
  87. package/dist/operations/mcp-adapter.js +0 -94
  88. package/dist/operations/metrics.d.ts +0 -30
  89. package/dist/operations/metrics.js +0 -114
  90. package/dist/operations/ops.d.ts +0 -28
  91. package/dist/operations/ops.js +0 -313
  92. package/dist/operations/projects.d.ts +0 -28
  93. package/dist/operations/projects.js +0 -36
  94. package/dist/operations/sdk-docs.d.ts +0 -28
  95. package/dist/operations/sdk-docs.js +0 -160
  96. package/dist/operations/types.d.ts +0 -138
  97. package/dist/operations/types.js +0 -9
  98. package/dist/operations/universes.d.ts +0 -28
  99. package/dist/operations/universes.js +0 -93
  100. package/dist/operations/util.d.ts +0 -33
  101. package/dist/operations/util.js +0 -9
  102. package/dist/resources/alert-rules.d.ts +0 -50
  103. package/dist/resources/alert-rules.js +0 -75
  104. package/dist/resources/attributes.d.ts +0 -19
  105. package/dist/resources/attributes.js +0 -10
  106. package/dist/resources/configs.d.ts +0 -681
  107. package/dist/resources/configs.js +0 -509
  108. package/dist/resources/events.d.ts +0 -61
  109. package/dist/resources/events.js +0 -42
  110. package/dist/resources/experiments.d.ts +0 -849
  111. package/dist/resources/experiments.js +0 -707
  112. package/dist/resources/gates.d.ts +0 -808
  113. package/dist/resources/gates.js +0 -522
  114. package/dist/resources/i18n.d.ts +0 -84
  115. package/dist/resources/i18n.js +0 -60
  116. package/dist/resources/index.d.ts +0 -2767
  117. package/dist/resources/index.js +0 -2563
  118. package/dist/resources/killswitches.d.ts +0 -436
  119. package/dist/resources/killswitches.js +0 -514
  120. package/dist/resources/metrics.d.ts +0 -54
  121. package/dist/resources/metrics.js +0 -40
  122. package/dist/resources/ops.d.ts +0 -88
  123. package/dist/resources/ops.js +0 -36
  124. package/dist/resources/projects.d.ts +0 -54
  125. package/dist/resources/projects.js +0 -14
  126. package/dist/resources/universes.d.ts +0 -185
  127. package/dist/resources/universes.js +0 -234
  128. package/dist/schemas/alert-rules.d.ts +0 -65
  129. package/dist/schemas/alert-rules.js +0 -37
  130. package/dist/schemas/configs.d.ts +0 -154
  131. package/dist/schemas/configs.js +0 -134
  132. package/dist/schemas/constants.d.ts +0 -6
  133. package/dist/schemas/constants.js +0 -7
  134. package/dist/schemas/experiments.d.ts +0 -229
  135. package/dist/schemas/experiments.js +0 -221
  136. package/dist/schemas/folder.d.ts +0 -10
  137. package/dist/schemas/folder.js +0 -8
  138. package/dist/schemas/gates.d.ts +0 -386
  139. package/dist/schemas/gates.js +0 -190
  140. package/dist/schemas/index.d.ts +0 -11
  141. package/dist/schemas/index.js +0 -762
  142. package/dist/schemas/killswitches.d.ts +0 -110
  143. package/dist/schemas/killswitches.js +0 -226
  144. package/dist/schemas/metric-name.d.ts +0 -5
  145. package/dist/schemas/metric-name.js +0 -6
  146. package/dist/schemas/pagination.d.ts +0 -37
  147. package/dist/schemas/pagination.js +0 -44
  148. package/dist/schemas/universes.d.ts +0 -35
  149. package/dist/schemas/universes.js +0 -55
  150. package/dist/transport.d.ts +0 -30
  151. package/dist/transport.js +0 -44
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shipeasy/openapi",
3
- "version": "1.6.0",
4
- "description": "Shipeasy admin OpenAPI spec + typed client. Single source of truth for endpoint paths, request/response shapes, and the resource registry consumed by @shipeasy/cli and @shipeasy/mcp.",
3
+ "version": "2.2.0",
4
+ "description": "Shipeasy admin OpenAPI 3.2 spec (hand-authored, single source of truth) + the generated TypeScript client, Zod schemas, and types. Consumed by @shipeasy/cli and @shipeasy/mcp.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -10,7 +10,8 @@
10
10
  },
11
11
  "repository": {
12
12
  "type": "git",
13
- "url": "git+https://github.com/shipeasy-ai/openapi.git"
13
+ "url": "git+https://github.com/shipeasy-ai/shipeasy.git",
14
+ "directory": "openapi"
14
15
  },
15
16
  "license": "MIT",
16
17
  "exports": {
@@ -18,51 +19,57 @@
18
19
  "types": "./dist/index.d.ts",
19
20
  "default": "./dist/index.js"
20
21
  },
21
- "./resources/*": {
22
- "types": "./dist/resources/*.d.ts",
23
- "default": "./dist/resources/*.js"
22
+ "./client": {
23
+ "types": "./dist/client.d.ts",
24
+ "default": "./dist/client.js"
24
25
  },
25
- "./schemas/*": {
26
- "types": "./dist/schemas/*.d.ts",
27
- "default": "./dist/schemas/*.js"
26
+ "./schemas": {
27
+ "types": "./dist/schemas.d.ts",
28
+ "default": "./dist/schemas.js"
28
29
  },
29
- "./operations": {
30
- "types": "./dist/operations/index.d.ts",
31
- "default": "./dist/operations/index.js"
32
- },
33
- "./transport": {
34
- "types": "./dist/transport.d.ts",
35
- "default": "./dist/transport.js"
36
- },
37
- "./pagination": {
38
- "types": "./dist/pagination.d.ts",
39
- "default": "./dist/pagination.js"
30
+ "./custom": {
31
+ "types": "./dist/custom.d.ts",
32
+ "default": "./dist/custom.js"
40
33
  },
41
34
  "./node-context": {
42
35
  "types": "./dist/node-context.d.ts",
43
36
  "default": "./dist/node-context.js"
44
- }
37
+ },
38
+ "./codegen": {
39
+ "types": "./src/codegen.ts",
40
+ "default": "./src/codegen.ts"
41
+ },
42
+ "./openapi.yaml": "./openapi.yaml",
43
+ "./openapi.json": "./openapi.json"
45
44
  },
46
45
  "files": [
47
46
  "dist/",
48
- "openapi.json"
47
+ "openapi.yaml",
48
+ "openapi.json",
49
+ "spec/"
49
50
  ],
50
51
  "scripts": {
52
+ "lint:spec": "redocly lint spec/openapi.yaml",
53
+ "bundle": "redocly bundle spec/openapi.yaml -o openapi.yaml && redocly bundle spec/openapi.yaml -o openapi.json",
54
+ "gen:sdk": "openapi-ts",
55
+ "gen": "pnpm bundle && pnpm gen:sdk",
56
+ "prebuild": "pnpm gen",
51
57
  "build": "tsup",
52
58
  "type-check": "tsc --noEmit",
53
59
  "test": "vitest run",
54
- "emit-openapi": "tsx scripts/emit-spec.ts"
60
+ "check:drift": "node scripts/check-drift.mjs"
55
61
  },
56
62
  "dependencies": {
57
63
  "zod": "^4.0.0"
58
64
  },
59
65
  "devDependencies": {
66
+ "@hey-api/openapi-ts": "^0.99.0",
67
+ "@redocly/cli": "^2.0.0",
60
68
  "@types/node": "^20.19.39",
61
- "openapi-types": "^12.1.3",
62
69
  "tsup": "^8.3.0",
63
- "tsx": "^4.21.0",
64
70
  "typescript": "^5.7.4",
65
- "vitest": "^2.1.0"
71
+ "vitest": "^2.1.0",
72
+ "yaml": "^2.5.0"
66
73
  },
67
74
  "engines": {
68
75
  "node": ">=20"
@@ -0,0 +1,53 @@
1
+ ErrorCode:
2
+ type: string
3
+ description: Stable, machine-readable error code. Mirrors the `ErrorCode` catalogue in `@shipeasy/core`. Each operation lists the subset it can return under `x-error-codes`.
4
+ enum:
5
+ - BAD_REQUEST
6
+ - UNAUTHORIZED
7
+ - FORBIDDEN
8
+ - PLAN_REQUIRED
9
+ - NOT_FOUND
10
+ - ALREADY_EXISTS
11
+ - INVALID_TRANSITION
12
+ - IMMUTABLE_FIELD
13
+ - READ_ONLY
14
+ - REFERENCED_IN_USE
15
+ - VALIDATION
16
+ - REFERENCED_NOT_FOUND
17
+ - GROUPS_WEIGHT_SUM
18
+ - EVENT_PENDING
19
+ - INTERNAL
20
+ x-enum-descriptions:
21
+ BAD_REQUEST: Malformed request (bad JSON, missing project scope).
22
+ UNAUTHORIZED: Missing or invalid admin SDK key.
23
+ FORBIDDEN: Key is valid but not allowed to act on this project.
24
+ PLAN_REQUIRED: The requested feature requires a higher plan tier (e.g. sequential testing, custom alpha, holdout, group count).
25
+ NOT_FOUND: The resource does not exist or is not visible to the caller.
26
+ ALREADY_EXISTS: A resource with this name already exists in the project.
27
+ INVALID_TRANSITION: The requested lifecycle transition is not allowed from the current state.
28
+ IMMUTABLE_FIELD: A field that is immutable in the current state was modified (e.g. editing allocation while running).
29
+ READ_ONLY: The resource is a read-only built-in (e.g. a built-in gate-rule template) and cannot be modified or deleted.
30
+ REFERENCED_IN_USE: The resource cannot be archived/deleted while another resource still references it.
31
+ VALIDATION: The request body failed structural (schema) validation.
32
+ REFERENCED_NOT_FOUND: A referenced entity (universe, metric, gate, event) does not exist.
33
+ GROUPS_WEIGHT_SUM: Experiment group weights must sum to 10000 (basis points).
34
+ EVENT_PENDING: The referenced event is still pending review and cannot back a metric yet.
35
+ INTERNAL: Unexpected server error.
36
+ Error:
37
+ type: object
38
+ description: Uniform error envelope returned by every admin endpoint on a non-2xx status. `error` is the human-readable message; `code` is the stable machine code (present whenever the failure maps to a catalogued `ErrorCode`); `detail` carries extra context (validation paths, conflicting field); `instructions` is optional actionable guidance for resolving the error.
39
+ required:
40
+ - error
41
+ additionalProperties: false
42
+ properties:
43
+ error:
44
+ type: string
45
+ description: Human-readable error message.
46
+ code:
47
+ $ref: ./errors.yaml#/ErrorCode
48
+ detail:
49
+ type: string
50
+ description: Extra context (validation details, conflicting field, referenced row).
51
+ instructions:
52
+ type: string
53
+ description: Actionable guidance for resolving this error — what to check or change next.
@@ -0,0 +1,32 @@
1
+ ProjectId:
2
+ name: X-Project-Id
3
+ in: header
4
+ required: false
5
+ description: Project the request operates on. Optional — defaults to the project the SDK key belongs to; pass it only to scope a multi-project key (the generated client sets it once from its configuration, so per-call callers never thread it).
6
+ schema:
7
+ type: string
8
+ PaginationLimit:
9
+ name: limit
10
+ in: query
11
+ required: false
12
+ description: Page size (1–500). Defaults to 100.
13
+ schema:
14
+ type: integer
15
+ minimum: 1
16
+ maximum: 500
17
+ default: 100
18
+ PaginationCursor:
19
+ name: cursor
20
+ in: query
21
+ required: false
22
+ description: Opaque cursor returned in the previous page's `next_cursor`. Omit for the first page.
23
+ schema:
24
+ type: string
25
+ Q:
26
+ name: q
27
+ in: query
28
+ required: false
29
+ description: Case-insensitive substring filter across the resource's human-readable text columns (e.g. `name`, `title`, `description`). OR-matched across those columns; omit to return everything.
30
+ schema:
31
+ type: string
32
+ maxLength: 100
@@ -0,0 +1,122 @@
1
+ BadRequest:
2
+ description: The request was malformed (bad JSON or missing project scope).
3
+ content:
4
+ application/json:
5
+ schema:
6
+ $ref: ./errors.yaml#/Error
7
+ examples:
8
+ BAD_REQUEST:
9
+ summary: Malformed request
10
+ value:
11
+ error: Malformed request (bad JSON, missing project scope).
12
+ code: BAD_REQUEST
13
+ Unauthorized:
14
+ description: Missing or invalid admin SDK key.
15
+ content:
16
+ application/json:
17
+ schema:
18
+ $ref: ./errors.yaml#/Error
19
+ examples:
20
+ UNAUTHORIZED:
21
+ summary: No / invalid key
22
+ value:
23
+ error: Missing or invalid admin SDK key.
24
+ code: UNAUTHORIZED
25
+ Forbidden:
26
+ description: The key is valid but not allowed to perform this action.
27
+ content:
28
+ application/json:
29
+ schema:
30
+ $ref: ./errors.yaml#/Error
31
+ examples:
32
+ FORBIDDEN:
33
+ summary: Not an admin of this project
34
+ value:
35
+ error: Key is valid but not allowed to act on this project.
36
+ code: FORBIDDEN
37
+ PLAN_REQUIRED:
38
+ summary: Feature gated behind a higher plan
39
+ value:
40
+ error: The requested feature requires a higher plan tier (e.g. sequential testing, custom alpha, holdout, group count).
41
+ code: PLAN_REQUIRED
42
+ NotFound:
43
+ description: The resource does not exist or is not visible to the caller.
44
+ content:
45
+ application/json:
46
+ schema:
47
+ $ref: ./errors.yaml#/Error
48
+ examples:
49
+ NOT_FOUND:
50
+ summary: Unknown id or name
51
+ value:
52
+ error: The resource does not exist or is not visible to the caller.
53
+ code: NOT_FOUND
54
+ Conflict:
55
+ description: The mutation conflicts with current state.
56
+ content:
57
+ application/json:
58
+ schema:
59
+ $ref: ./errors.yaml#/Error
60
+ examples:
61
+ ALREADY_EXISTS:
62
+ summary: Duplicate name
63
+ value:
64
+ error: A resource with this name already exists in the project.
65
+ code: ALREADY_EXISTS
66
+ REFERENCED_IN_USE:
67
+ summary: Still referenced by another resource
68
+ value:
69
+ error: The resource cannot be archived/deleted while another resource still references it.
70
+ code: REFERENCED_IN_USE
71
+ INVALID_TRANSITION:
72
+ summary: Illegal lifecycle transition
73
+ value:
74
+ error: The requested lifecycle transition is not allowed from the current state.
75
+ code: INVALID_TRANSITION
76
+ IMMUTABLE_FIELD:
77
+ summary: Edited an immutable field while running
78
+ value:
79
+ error: A field that is immutable in the current state was modified (e.g. editing allocation while running).
80
+ code: IMMUTABLE_FIELD
81
+ UnprocessableEntity:
82
+ description: The request body failed validation.
83
+ content:
84
+ application/json:
85
+ schema:
86
+ $ref: ./errors.yaml#/Error
87
+ examples:
88
+ VALIDATION:
89
+ summary: Schema validation failed
90
+ value:
91
+ error: The request body failed structural (schema) validation.
92
+ code: VALIDATION
93
+ REFERENCED_NOT_FOUND:
94
+ summary: Referenced entity missing
95
+ value:
96
+ error: A referenced entity (universe, metric, gate, event) does not exist.
97
+ code: REFERENCED_NOT_FOUND
98
+ GROUPS_WEIGHT_SUM:
99
+ summary: Group weights must sum to 10000
100
+ value:
101
+ error: Experiment group weights must sum to 10000 (basis points).
102
+ code: GROUPS_WEIGHT_SUM
103
+ EVENT_PENDING:
104
+ summary: Event still pending review
105
+ value:
106
+ error: The referenced event is still pending review and cannot back a metric yet.
107
+ code: EVENT_PENDING
108
+ BadGateway:
109
+ description: |-
110
+ The request was well-formed and the resource exists, but a downstream provider
111
+ the endpoint delegates to (e.g. a connector's Slack/GitHub/cloud-agent dispatch)
112
+ failed. The failure is upstream of this API, not a client error. No stable
113
+ `ErrorCode` is assigned to upstream failures, so `code` is omitted.
114
+ content:
115
+ application/json:
116
+ schema:
117
+ $ref: ./errors.yaml#/Error
118
+ examples:
119
+ UPSTREAM_FAILURE:
120
+ summary: Downstream provider dispatch failed
121
+ value:
122
+ error: "GitHub API responded 403: resource not accessible by integration."
@@ -0,0 +1,175 @@
1
+ ListAlertRulesResponse:
2
+ type: array
3
+ items:
4
+ type: object
5
+ properties:
6
+ id:
7
+ type: string
8
+ description: Stable opaque alert-rule id.
9
+ name:
10
+ type: string
11
+ description: Human label for the rule.
12
+ metricId:
13
+ type: string
14
+ description: Id of the metric the rule evaluates. Immutable after create.
15
+ metricName:
16
+ anyOf:
17
+ - type: string
18
+ - type: "null"
19
+ description: Display name of the bound metric, or `null` if the metric no longer exists.
20
+ comparator:
21
+ type: string
22
+ enum:
23
+ - gt
24
+ - gte
25
+ - lt
26
+ - lte
27
+ description: How the metric value is compared to the threshold (gt/gte/lt/lte).
28
+ threshold:
29
+ type: number
30
+ description: Threshold the metric value is compared against.
31
+ windowHours:
32
+ type: integer
33
+ minimum: -9007199254740991
34
+ maximum: 9007199254740991
35
+ description: Lookback window (hours) the metric is aggregated over.
36
+ severity:
37
+ type: string
38
+ enum:
39
+ - danger
40
+ - warn
41
+ - info
42
+ description: Severity of the raised alert.
43
+ enabled:
44
+ type: boolean
45
+ description: Whether the rule is evaluated by the cron.
46
+ notify:
47
+ $ref: ./common.yaml#/NotificationTarget
48
+ createdAt:
49
+ type: string
50
+ description: ISO-8601 timestamp of creation.
51
+ updatedAt:
52
+ type: string
53
+ description: ISO-8601 timestamp of the last update.
54
+ required:
55
+ - id
56
+ - name
57
+ - metricId
58
+ - metricName
59
+ - comparator
60
+ - threshold
61
+ - windowHours
62
+ - severity
63
+ - enabled
64
+ - notify
65
+ - createdAt
66
+ - updatedAt
67
+ additionalProperties: false
68
+ description: One metric-threshold alert rule.
69
+ CreateAlertRuleRequest:
70
+ type: object
71
+ properties:
72
+ name:
73
+ type: string
74
+ minLength: 1
75
+ maxLength: 120
76
+ description: Human label for the rule, shown on the alert and the rules list.
77
+ metricId:
78
+ type: string
79
+ minLength: 1
80
+ description: Id of the metric to evaluate.
81
+ comparator:
82
+ type: string
83
+ enum:
84
+ - gt
85
+ - gte
86
+ - lt
87
+ - lte
88
+ description: How the metric value is compared to the threshold (gt/gte/lt/lte).
89
+ threshold:
90
+ type: number
91
+ description: Threshold the metric value is compared against.
92
+ windowHours:
93
+ default: 24
94
+ description: Lookback window (hours) the metric is aggregated over. 1–720.
95
+ type: integer
96
+ minimum: 1
97
+ maximum: 720
98
+ severity:
99
+ default: warn
100
+ description: Severity of the raised alert.
101
+ type: string
102
+ enum:
103
+ - danger
104
+ - warn
105
+ - info
106
+ enabled:
107
+ default: true
108
+ description: Whether the rule is evaluated by the cron.
109
+ type: boolean
110
+ notify:
111
+ $ref: ./common.yaml#/NotificationTarget
112
+ required:
113
+ - name
114
+ - metricId
115
+ - comparator
116
+ - threshold
117
+ additionalProperties: false
118
+ CreateAlertRuleResponse:
119
+ type: object
120
+ properties:
121
+ id:
122
+ type: string
123
+ description: Newly assigned alert-rule id.
124
+ required:
125
+ - id
126
+ additionalProperties: false
127
+ UpdateAlertRuleRequest:
128
+ type: object
129
+ properties:
130
+ name:
131
+ type: string
132
+ minLength: 1
133
+ maxLength: 120
134
+ comparator:
135
+ type: string
136
+ enum:
137
+ - gt
138
+ - gte
139
+ - lt
140
+ - lte
141
+ threshold:
142
+ type: number
143
+ windowHours:
144
+ type: integer
145
+ minimum: 1
146
+ maximum: 720
147
+ severity:
148
+ type: string
149
+ enum:
150
+ - danger
151
+ - warn
152
+ - info
153
+ enabled:
154
+ type: boolean
155
+ notify:
156
+ $ref: ./common.yaml#/NotificationTarget
157
+ additionalProperties: false
158
+ UpdateAlertRuleResponse:
159
+ type: object
160
+ properties:
161
+ id:
162
+ type: string
163
+ description: Newly assigned alert-rule id.
164
+ required:
165
+ - id
166
+ additionalProperties: false
167
+ DeleteAlertRuleResponse:
168
+ type: object
169
+ properties:
170
+ ok:
171
+ type: boolean
172
+ const: true
173
+ required:
174
+ - ok
175
+ additionalProperties: false
@@ -0,0 +1,157 @@
1
+ ListAttributesResponse:
2
+ type: array
3
+ items:
4
+ type: object
5
+ properties:
6
+ name:
7
+ type: string
8
+ description: Attribute key as seen in evaluation context (e.g. `plan`, `country`).
9
+ type:
10
+ description: Inferred value type (`string`, `number`, `boolean`, …) when known.
11
+ type: string
12
+ required:
13
+ - name
14
+ additionalProperties: {}
15
+ description: One auto-inferred targeting attribute.
16
+ description: Every auto-inferred targeting attribute in the project.
17
+ AttributeType:
18
+ type: string
19
+ enum:
20
+ - string
21
+ - number
22
+ - boolean
23
+ - enum
24
+ - date
25
+ description: Declared value type of a targeting attribute.
26
+ CreateAttributeRequest:
27
+ type: object
28
+ properties:
29
+ name:
30
+ type: string
31
+ pattern: ^[a-z0-9][a-z0-9_-]{0,63}$
32
+ description: Attribute key (lowercase alphanumeric start, then letters/digits/`_`/`-`; max 64 chars). Immutable after create.
33
+ type:
34
+ $ref: "#/AttributeType"
35
+ enum_values:
36
+ anyOf:
37
+ - type: array
38
+ items:
39
+ type: string
40
+ - type: "null"
41
+ default: null
42
+ description: Allowed values when `type` is `enum` (required in that case — 422 otherwise); `null` for non-enum types.
43
+ required:
44
+ type: boolean
45
+ default: false
46
+ description: Whether the attribute must be present on the evaluation context.
47
+ description:
48
+ type: string
49
+ description: Optional human note shown in the dashboard.
50
+ sdk_path:
51
+ type: string
52
+ description: Optional dotted path the SDK reads the value from.
53
+ required:
54
+ - name
55
+ - type
56
+ additionalProperties: false
57
+ description: Body for `POST /api/admin/attributes`. Declares a targeting attribute.
58
+ CreateAttributeResponse:
59
+ type: object
60
+ properties:
61
+ id:
62
+ type: string
63
+ description: Newly assigned attribute id.
64
+ name:
65
+ type: string
66
+ description: The attribute key that was created.
67
+ required:
68
+ - id
69
+ - name
70
+ additionalProperties: false
71
+ description: Response for `POST /api/admin/attributes`.
72
+ UpdateAttributeRequest:
73
+ type: object
74
+ properties:
75
+ type:
76
+ $ref: "#/AttributeType"
77
+ enum_values:
78
+ anyOf:
79
+ - type: array
80
+ items:
81
+ type: string
82
+ - type: "null"
83
+ description: Replacement allowed values (for `enum`), or `null` to clear.
84
+ required:
85
+ type: boolean
86
+ description: Whether the attribute must be present on the evaluation context.
87
+ description:
88
+ type: string
89
+ description: Optional human note shown in the dashboard.
90
+ sdk_path:
91
+ type: string
92
+ description: Optional dotted path the SDK reads the value from.
93
+ additionalProperties: false
94
+ description: "Body for `PATCH /api/admin/attributes/{id}`. Every field is optional; `name` is immutable."
95
+ UpdateAttributeResponse:
96
+ type: object
97
+ properties:
98
+ id:
99
+ type: string
100
+ description: Id of the attribute that was updated.
101
+ required:
102
+ - id
103
+ additionalProperties: false
104
+ description: Response for `PATCH /api/admin/attributes/{id}`.
105
+ GetAttributeResponse:
106
+ type: object
107
+ properties:
108
+ id:
109
+ type: string
110
+ description: Stable opaque attribute id.
111
+ name:
112
+ type: string
113
+ description: Attribute key.
114
+ type:
115
+ $ref: "#/AttributeType"
116
+ enumValues:
117
+ anyOf:
118
+ - type: array
119
+ items:
120
+ type: string
121
+ - type: "null"
122
+ description: Allowed values for `enum` attributes, else `null`.
123
+ required:
124
+ type: integer
125
+ enum:
126
+ - 0
127
+ - 1
128
+ description: Whether the attribute is required (D1 stores the flag as `0`/`1`).
129
+ description:
130
+ anyOf:
131
+ - type: string
132
+ - type: "null"
133
+ description: Human note, or `null`.
134
+ sdkPath:
135
+ anyOf:
136
+ - type: string
137
+ - type: "null"
138
+ description: Dotted SDK path, or `null`.
139
+ createdAt:
140
+ type: string
141
+ description: ISO-8601 creation timestamp.
142
+ required:
143
+ - id
144
+ - name
145
+ - type
146
+ additionalProperties: {}
147
+ description: One targeting attribute row.
148
+ DeleteAttributeResponse:
149
+ type: object
150
+ properties:
151
+ ok:
152
+ type: boolean
153
+ description: True when the attribute was archived.
154
+ required:
155
+ - ok
156
+ additionalProperties: false
157
+ description: Response for `DELETE /api/admin/attributes/{id}`.