@sylphx/sdk 0.30.0 → 0.32.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.
- package/README.md +123 -0
- package/dist/access.d.ts +126 -20
- package/dist/access.js +111 -15
- package/dist/access.js.map +1 -1
- package/dist/ai.d.ts +1 -2
- package/dist/ai.js +2 -3
- package/dist/ai.js.map +1 -1
- package/dist/artifacts.d.ts +1 -1
- package/dist/artifacts.js +2 -2
- package/dist/assets.d.ts +447 -0
- package/dist/assets.js +266 -0
- package/dist/assets.js.map +1 -0
- package/dist/auth/client.d.ts +239 -0
- package/dist/auth/client.js +337 -0
- package/dist/auth/client.js.map +1 -0
- package/dist/auth/verify.d.ts +92 -0
- package/dist/auth/verify.js +207 -0
- package/dist/auth/verify.js.map +1 -0
- package/dist/auth.d.ts +455 -7
- package/dist/auth.js +416 -5
- package/dist/auth.js.map +1 -1
- package/dist/billing.d.ts +113 -17
- package/dist/billing.js +45 -5
- package/dist/billing.js.map +1 -1
- package/dist/broker.d.ts +5 -4
- package/dist/broker.js +3 -3
- package/dist/broker.js.map +1 -1
- package/dist/build.d.ts +4 -4
- package/dist/build.js +3 -3
- package/dist/common.d.ts +1 -1
- package/dist/common.js +1 -1
- package/dist/config/flags.d.ts +140 -0
- package/dist/config/flags.js +462 -0
- package/dist/config/flags.js.map +1 -0
- package/dist/config.d.ts +380 -15
- package/dist/config.js +283 -5
- package/dist/config.js.map +1 -1
- package/dist/connections.d.ts +6 -6
- package/dist/connections.js +3 -3
- package/dist/data.d.ts +844 -8
- package/dist/data.js +779 -5
- package/dist/data.js.map +1 -1
- package/dist/entitlement.d.ts +18 -9
- package/dist/entitlement.js +4 -4
- package/dist/entitlement.js.map +1 -1
- package/dist/events/realtime.d.ts +69 -0
- package/dist/events/realtime.js +107 -0
- package/dist/events/realtime.js.map +1 -0
- package/dist/events/webhooks.d.ts +40 -0
- package/dist/events/webhooks.js +110 -0
- package/dist/events/webhooks.js.map +1 -0
- package/dist/events.d.ts +369 -22
- package/dist/events.js +311 -8
- package/dist/events.js.map +1 -1
- package/dist/hosting.d.ts +13 -14
- package/dist/hosting.js +3 -4
- package/dist/hosting.js.map +1 -1
- package/dist/ids.d.ts +837 -0
- package/dist/ids.js +287 -0
- package/dist/ids.js.map +1 -0
- package/dist/index.d.ts +12 -1
- package/dist/index.js +16 -2
- package/dist/index.js.map +1 -1
- package/dist/keys.d.ts +2 -2
- package/dist/keys.js +3 -3
- package/dist/localization.d.ts +663 -0
- package/dist/localization.js +491 -0
- package/dist/localization.js.map +1 -0
- package/dist/methods.js +1933 -133
- package/dist/methods.js.map +1 -1
- package/dist/money.d.ts +1406 -0
- package/dist/money.js +1090 -0
- package/dist/money.js.map +1 -0
- package/dist/network.d.ts +4 -5
- package/dist/network.js +3 -4
- package/dist/network.js.map +1 -1
- package/dist/notify.d.ts +718 -127
- package/dist/notify.js +493 -74
- package/dist/notify.js.map +1 -1
- package/dist/observability.d.ts +184 -7
- package/dist/observability.js +156 -8
- package/dist/observability.js.map +1 -1
- package/dist/release.d.ts +14 -15
- package/dist/release.js +3 -4
- package/dist/release.js.map +1 -1
- package/dist/runners.d.ts +2 -3
- package/dist/runners.js +3 -4
- package/dist/runners.js.map +1 -1
- package/dist/runtime.d.ts +42 -5
- package/dist/runtime.js +101 -18
- package/dist/runtime.js.map +1 -1
- package/dist/sandboxes.d.ts +64 -20
- package/dist/sandboxes.js +9 -4
- package/dist/sandboxes.js.map +1 -1
- package/dist/secrets.d.ts +6 -6
- package/dist/secrets.js +4 -4
- package/dist/workflows.d.ts +850 -12
- package/dist/workflows.js +672 -3
- package/dist/workflows.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -32,8 +32,131 @@ for await (const project of sylphx.access.projects.listAll({ parent: me.org }))
|
|
|
32
32
|
`Retry-After`; each logical mutation sends one `Idempotency-Key`.
|
|
33
33
|
- `sylphx.invoke('data.databases.get', { name })` calls any method by id with
|
|
34
34
|
wire JSON.
|
|
35
|
+
- In a browser, use the environment's publishable key
|
|
36
|
+
(`SYLPHX_PUBLISHABLE_KEY`, delivered by the platform to every service and
|
|
37
|
+
safe to ship in a bundle). It calls only browser-safe methods, such as error
|
|
38
|
+
capture:
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
const sylphx = new Sylphx({ apiKey: PUBLISHABLE_KEY }) // e.g. from a public build-time variable
|
|
42
|
+
window.addEventListener('error', (e) =>
|
|
43
|
+
sylphx.observability.errorGroups.capture({
|
|
44
|
+
parent: 'orgs/-/projects/-/envs/-',
|
|
45
|
+
errorEvent: { exceptionType: e.error?.name ?? 'Error', message: e.message, stack: e.error?.stack, release: RELEASE },
|
|
46
|
+
}),
|
|
47
|
+
)
|
|
48
|
+
```
|
|
49
|
+
- Some services also have a data plane served at their own host, with the same
|
|
50
|
+
key: Sylphx Data's objects, key-value entries, and search documents are
|
|
51
|
+
`sylphx.data.objects`, `sylphx.data.kv` (strings and counters, plus
|
|
52
|
+
`getMany`, hashes, lists, sorted sets, `scan`, and `expire`),
|
|
53
|
+
`sylphx.data.documents`, and `sylphx.data.search` (at
|
|
54
|
+
`https://api.data.sylphx.com`). Every such call
|
|
55
|
+
carries one `Sylphx-Effect-Id`, reused on its retries, so a retried write is
|
|
56
|
+
applied once.
|
|
57
|
+
- `SYLPHX_URL` and `SYLPHX_SECRET_URL` (per-project `<project>.api.sylphx.com`
|
|
58
|
+
hosts, retired on 2026-09-03) are not read; a base URL on such a host is
|
|
59
|
+
ignored with a warning.
|
|
35
60
|
- Per-service subpath imports tree-shake: `import { DataApi } from '@sylphx/sdk/data'`.
|
|
36
61
|
|
|
62
|
+
```ts
|
|
63
|
+
// Bytes travel base64 (`body`, `value`, `documentJson`); the bucket, namespace,
|
|
64
|
+
// and index are Data Resources of the environment (`sylphx.data.buckets`,
|
|
65
|
+
// `sylphx.data.kvNamespaces`, `sylphx.data.searchIndexes`).
|
|
66
|
+
await sylphx.data.objects.put({ bucketId: 'uploads', key: `${orgId}/cv.pdf`, body: base64, contentType: 'application/pdf' })
|
|
67
|
+
const { body } = await sylphx.data.objects.get({ bucketId: 'uploads', key: `${orgId}/cv.pdf` })
|
|
68
|
+
const hits = await sylphx.data.kv.increment({ namespaceId: 'ratelimit', key: `ip:${ip}` })
|
|
69
|
+
await sylphx.data.kv.zsetAdd({ namespaceId: 'board', key: 'weekly', members: [{ member: userId, score: 120 }] })
|
|
70
|
+
const { score } = await sylphx.data.kv.zsetScore({ namespaceId: 'board', key: 'weekly', member: userId })
|
|
71
|
+
await sylphx.data.documents.put({ indexId: 'articles', documentId: slug, documentJson: btoa(JSON.stringify(article)) })
|
|
72
|
+
const { hits: found } = await sylphx.data.search.query({ indexId: 'articles', query: 'pricing', limit: 10 })
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Object upload transport and older SDKs
|
|
76
|
+
|
|
77
|
+
`data.objects.put` sends base64 bytes in an authenticated JSON request. Its
|
|
78
|
+
HTTP Content-Type is `application/json`; the object's MIME is the JSON
|
|
79
|
+
`contentType` field. It does not mint or PUT to presigned multipart URLs.
|
|
80
|
+
|
|
81
|
+
The older `@sylphx/sdk@0.27.0` exported `storage.uploads.create` and sent
|
|
82
|
+
Blob slices to presigned part URLs. That API is absent from this generated
|
|
83
|
+
SDK: upgrading such a caller requires migrating its upload and file-management
|
|
84
|
+
calls to Data's object API, not only changing its package pin. The old
|
|
85
|
+
`@sylphx/sdk/react`, `/server`, and `/nextjs` integrations are not equivalent
|
|
86
|
+
exports of this package either.
|
|
87
|
+
|
|
37
88
|
This package is generated from the Sylphx schema registry by `sylphx-gen`; do
|
|
38
89
|
not edit it by hand. Source: `clients/typescript` in the Sylphx monorepo,
|
|
39
90
|
published from its MIT mirror.
|
|
91
|
+
|
|
92
|
+
## Browser sign-in: `createAuthClient`
|
|
93
|
+
|
|
94
|
+
A small client for Sylphx Auth's client API (`/v1/client/*`) in a browser app.
|
|
95
|
+
It holds only a publishable key (`sylphx_pk_...`, public by design); a secret
|
|
96
|
+
key given to it throws.
|
|
97
|
+
|
|
98
|
+
```ts
|
|
99
|
+
import { createAuthClient } from '@sylphx/sdk/auth/client' // also exported from '@sylphx/sdk'
|
|
100
|
+
|
|
101
|
+
const auth = createAuthClient({ publishableKey: 'sylphx_pk_live_...' })
|
|
102
|
+
const config = await auth.config() // methods, social providers, branding
|
|
103
|
+
const { session, user } = await auth.signInWithPassword({ email, password })
|
|
104
|
+
await auth.getSession()
|
|
105
|
+
await auth.signOut()
|
|
106
|
+
|
|
107
|
+
// Social sign-in is a navigation; the callback appends ?auth_ticket=...
|
|
108
|
+
// (config().ticketParam names it)
|
|
109
|
+
location.assign(auth.oauthStartUrl('google', { redirectUrl: location.href }))
|
|
110
|
+
await auth.redeemTicket(new URLSearchParams(location.search).get('auth_ticket')!)
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
- Every call carries `publishable_key` (or `instance`, the public slug) in the
|
|
114
|
+
query string, same-origin or not: a browser preflight has no `Authorization`,
|
|
115
|
+
and the query is where Auth learns the environment before it answers CORS.
|
|
116
|
+
An existing query is kept and the parameter is never duplicated. The key is
|
|
117
|
+
never sent as a Bearer.
|
|
118
|
+
- Options: `publishableKey` or `instance` (exactly one), `baseUrl`
|
|
119
|
+
(default `https://api.sylphx.com`), `fetch`, `credentials` (default `'omit'`;
|
|
120
|
+
`'include'` is opt-in), `sessionToken` (to restore a session).
|
|
121
|
+
- Add your app's origin to `allowed_origins` on the environment's Auth Config
|
|
122
|
+
to make browsers refuse every origin you did not name.
|
|
123
|
+
- Errors are `AuthClientError` subclasses keyed on the service's `code`
|
|
124
|
+
(`AuthUnauthorizedError`, `AuthMfaRequiredError`, `AuthRateLimitedError`
|
|
125
|
+
with `retryAfterSeconds`, `AuthNetworkError`, ...), not `SylphxError`.
|
|
126
|
+
|
|
127
|
+
### The session is a bearer token in JavaScript (XSS trade-off)
|
|
128
|
+
|
|
129
|
+
There is no cookie mode. The client asks for `session_mode: "browser"`, so the
|
|
130
|
+
session token is a bearer value that page script holds. A script injected into
|
|
131
|
+
your page (XSS) can read it. Keep the token out of URLs and logs, and keep a
|
|
132
|
+
strict Content-Security-Policy.
|
|
133
|
+
|
|
134
|
+
If your app has a backend and needs an HttpOnly cookie, use the server (BFF)
|
|
135
|
+
pattern instead: the page only ever holds a one-time ticket, and your server
|
|
136
|
+
redeems it with the secret key and sets the cookie on your own origin.
|
|
137
|
+
|
|
138
|
+
```ts
|
|
139
|
+
// Browser: sign in with the default server mode; hand the ticket to your backend.
|
|
140
|
+
const res = await fetch(`https://api.sylphx.com/v1/client/sign-in/password?publishable_key=${pk}`, {
|
|
141
|
+
method: 'POST',
|
|
142
|
+
headers: { 'content-type': 'application/json' },
|
|
143
|
+
body: JSON.stringify({ email, password }), // session_mode defaults to "server"
|
|
144
|
+
})
|
|
145
|
+
const { ticket } = await res.json()
|
|
146
|
+
await fetch('/auth/session', { method: 'POST', body: JSON.stringify({ ticket }) })
|
|
147
|
+
|
|
148
|
+
// Your server (secret key stays here; forward the browser's User-Agent):
|
|
149
|
+
const redeemed = await fetch('https://api.sylphx.com/v1/client/tickets:redeem', {
|
|
150
|
+
method: 'POST',
|
|
151
|
+
headers: {
|
|
152
|
+
authorization: `Bearer ${process.env.SYLPHX_AUTH_SECRET_KEY}`,
|
|
153
|
+
'content-type': 'application/json',
|
|
154
|
+
'user-agent': request.headers.get('user-agent') ?? '',
|
|
155
|
+
},
|
|
156
|
+
body: JSON.stringify({ ticket }),
|
|
157
|
+
})
|
|
158
|
+
const { session } = await redeemed.json()
|
|
159
|
+
// Set-Cookie: session=<session.token>; HttpOnly; Secure; SameSite=Lax
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
`@sylphx/nextjs` ships this pattern as a route handler.
|
package/dist/access.d.ts
CHANGED
|
@@ -2,12 +2,16 @@ import * as runtime from './runtime.js';
|
|
|
2
2
|
import './common.js';
|
|
3
3
|
import type * as common from './common.js';
|
|
4
4
|
/**
|
|
5
|
-
* An ApiKey is a credential of one environment,
|
|
6
|
-
* (
|
|
7
|
-
*
|
|
5
|
+
* An ApiKey is a credential of one environment, or an org-wide key of an
|
|
6
|
+
* org (it acts on every project of the org), issued only by Access (the
|
|
7
|
+
* platform has one key system). The secret is returned once, by Create and
|
|
8
|
+
* Roll, and never again.
|
|
8
9
|
*/
|
|
9
10
|
export interface ApiKey {
|
|
10
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* `orgs/{org}/projects/{project}/envs/{env}/api_keys/{api_key}`, or
|
|
13
|
+
* `orgs/{org}/api_keys/{api_key}` for an org-wide key.
|
|
14
|
+
*/
|
|
11
15
|
name?: string;
|
|
12
16
|
/** `key_<cell><ulid>`; equals the name segment. */
|
|
13
17
|
readonly uid?: string;
|
|
@@ -25,10 +29,7 @@ export interface ApiKeySpec {
|
|
|
25
29
|
* only).
|
|
26
30
|
*/
|
|
27
31
|
kind?: ApiKeyKind;
|
|
28
|
-
/**
|
|
29
|
-
* Scopes `<service>:<action>` (access-and-keys.md §5.1), a subset of the
|
|
30
|
-
* creator's effective scopes.
|
|
31
|
-
*/
|
|
32
|
+
/** Scopes `<service>:<action>`, a subset of the creator's effective scopes. */
|
|
32
33
|
scopes?: string[];
|
|
33
34
|
/** A free-form label, for example the talent id a key was minted for. */
|
|
34
35
|
label?: string;
|
|
@@ -53,6 +54,13 @@ export interface ApiKeyStatus {
|
|
|
53
54
|
readonly revokeReason?: RevokeReason;
|
|
54
55
|
/** When the key last verified, at snapshot granularity. */
|
|
55
56
|
readonly lastUseTime?: string;
|
|
57
|
+
/** The client address of the key's last use. */
|
|
58
|
+
readonly lastUseIp?: string;
|
|
59
|
+
/**
|
|
60
|
+
* A device key (`sylphx login`): bound to the approving human's role in
|
|
61
|
+
* the org, and revoked when that role changes or the human leaves.
|
|
62
|
+
*/
|
|
63
|
+
readonly roleBound?: boolean;
|
|
56
64
|
}
|
|
57
65
|
/** The request of CreateApiKey. */
|
|
58
66
|
export interface CreateApiKeyRequest {
|
|
@@ -189,6 +197,11 @@ export interface GetProjectRequest {
|
|
|
189
197
|
/** The name of the project to get. */
|
|
190
198
|
name: string;
|
|
191
199
|
}
|
|
200
|
+
/** The request of GetServiceEnablement. */
|
|
201
|
+
export interface GetServiceEnablementRequest {
|
|
202
|
+
/** The name of the service enablement to get. */
|
|
203
|
+
name: string;
|
|
204
|
+
}
|
|
192
205
|
/** The request of ListApiKeys. */
|
|
193
206
|
export interface ListApiKeysRequest {
|
|
194
207
|
/** The parent to list in. */
|
|
@@ -267,6 +280,26 @@ export interface ListProjectsResponse {
|
|
|
267
280
|
/** The token of the next page; empty on the last page. */
|
|
268
281
|
nextPageToken?: string;
|
|
269
282
|
}
|
|
283
|
+
/** The request of ListServiceEnablements. */
|
|
284
|
+
export interface ListServiceEnablementsRequest {
|
|
285
|
+
/** The parent to list in. */
|
|
286
|
+
parent: string;
|
|
287
|
+
/** At most this many; default 50, clamped to 1000. */
|
|
288
|
+
pageSize?: number;
|
|
289
|
+
/** `next_page_token` of the previous page. */
|
|
290
|
+
pageToken?: string;
|
|
291
|
+
/** AIP-160 filter over labels, filterable spec fields, and Ready. */
|
|
292
|
+
filter?: string;
|
|
293
|
+
/** AIP-132 ordering over filterable fields. */
|
|
294
|
+
orderBy?: string;
|
|
295
|
+
}
|
|
296
|
+
/** The response of ListServiceEnablements. */
|
|
297
|
+
export interface ListServiceEnablementsResponse {
|
|
298
|
+
/** The page. */
|
|
299
|
+
serviceEnablements?: ServiceEnablement[];
|
|
300
|
+
/** The token of the next page; empty on the last page. */
|
|
301
|
+
nextPageToken?: string;
|
|
302
|
+
}
|
|
270
303
|
/** An Org is the one Sylphx account: created once, billed once. */
|
|
271
304
|
export interface Org {
|
|
272
305
|
/** `orgs/{org}`. */
|
|
@@ -286,7 +319,7 @@ export interface OrgSpec {
|
|
|
286
319
|
slug?: string;
|
|
287
320
|
/**
|
|
288
321
|
* The API version (`YYYY-MM-DD`) requests are served at when neither the
|
|
289
|
-
* request nor the key pins one
|
|
322
|
+
* request nor the key pins one.
|
|
290
323
|
*/
|
|
291
324
|
apiVersion?: string;
|
|
292
325
|
}
|
|
@@ -302,7 +335,7 @@ export interface OrgStatus {
|
|
|
302
335
|
readonly state?: OrgState;
|
|
303
336
|
/** The partner org, set iff `kind` is PARTNER_SUB. */
|
|
304
337
|
readonly parentOrg?: string;
|
|
305
|
-
/** The org's home
|
|
338
|
+
/** The org's home cell code, for example `fs01`. */
|
|
306
339
|
readonly homeCell?: string;
|
|
307
340
|
}
|
|
308
341
|
/** A Project groups environments and the Resources in them. */
|
|
@@ -352,6 +385,38 @@ export interface RollApiKeyRequest {
|
|
|
352
385
|
/** Validate without rolling. */
|
|
353
386
|
validateOnly?: boolean;
|
|
354
387
|
}
|
|
388
|
+
/**
|
|
389
|
+
* A ServiceEnablement says whether one service is enabled on a Project: the
|
|
390
|
+
* project's keys reach a service only while it is enabled (onboarding spec
|
|
391
|
+
* §3.2). It is project-scoped, applies to every environment of the project,
|
|
392
|
+
* and is named by the service id (`data`, `hosting`, ...): the rows are fixed
|
|
393
|
+
* by the platform's service list, so there is no create or delete, and an
|
|
394
|
+
* update writes `spec.enabled`.
|
|
395
|
+
*/
|
|
396
|
+
export interface ServiceEnablement {
|
|
397
|
+
/** `orgs/{org}/projects/{project}/service_enablements/{service}`. */
|
|
398
|
+
name?: string;
|
|
399
|
+
/** The service id; equals the name segment. */
|
|
400
|
+
readonly uid?: string;
|
|
401
|
+
/** Resource metadata. */
|
|
402
|
+
meta?: common.ResourceMeta;
|
|
403
|
+
/** Desired state. */
|
|
404
|
+
spec?: ServiceEnablementSpec;
|
|
405
|
+
/** Observed state. */
|
|
406
|
+
readonly status?: ServiceEnablementStatus;
|
|
407
|
+
}
|
|
408
|
+
/** ServiceEnablementSpec is the caller-writable state of a ServiceEnablement. */
|
|
409
|
+
export interface ServiceEnablementSpec {
|
|
410
|
+
/** Whether the project's keys may reach the service. */
|
|
411
|
+
enabled?: boolean;
|
|
412
|
+
}
|
|
413
|
+
/** ServiceEnablementStatus is the observed state of a ServiceEnablement. */
|
|
414
|
+
export interface ServiceEnablementStatus {
|
|
415
|
+
/** The generation this status was computed from. */
|
|
416
|
+
readonly observedGeneration?: string;
|
|
417
|
+
/** Ready, Reconciling, Stalled. */
|
|
418
|
+
readonly conditions?: common.Condition[];
|
|
419
|
+
}
|
|
355
420
|
/** The request of UpdateApiKey. */
|
|
356
421
|
export interface UpdateApiKeyRequest {
|
|
357
422
|
/** The API key to update; `name` identifies it. */
|
|
@@ -388,6 +453,15 @@ export interface UpdateProjectRequest {
|
|
|
388
453
|
/** Validate and return the result without writing anything. */
|
|
389
454
|
validateOnly?: boolean;
|
|
390
455
|
}
|
|
456
|
+
/** The request of UpdateServiceEnablement. */
|
|
457
|
+
export interface UpdateServiceEnablementRequest {
|
|
458
|
+
/** The service enablement to update; `name` identifies it. */
|
|
459
|
+
serviceEnablement: ServiceEnablement;
|
|
460
|
+
/** The fields to write; unset writes every populated field. */
|
|
461
|
+
updateMask?: string;
|
|
462
|
+
/** Validate and return the result without writing anything. */
|
|
463
|
+
validateOnly?: boolean;
|
|
464
|
+
}
|
|
391
465
|
/** The request of Whoami. */
|
|
392
466
|
export interface WhoamiRequest {
|
|
393
467
|
}
|
|
@@ -406,8 +480,8 @@ export interface WhoamiResponse {
|
|
|
406
480
|
/** The credential's scopes, `<service>:<action>`. */
|
|
407
481
|
readonly scopes?: string[];
|
|
408
482
|
/**
|
|
409
|
-
* The API version date applied to this request
|
|
410
|
-
*
|
|
483
|
+
* The API version date applied to this request; empty before the first
|
|
484
|
+
* version.
|
|
411
485
|
*/
|
|
412
486
|
readonly apiVersion?: string;
|
|
413
487
|
}
|
|
@@ -420,11 +494,10 @@ export type OrgKind = 'standard' | 'unclaimed' | 'partner_sub' | (string & {});
|
|
|
420
494
|
/** OrgState is the lifecycle state of an Org. */
|
|
421
495
|
export type OrgState = 'active' | 'suspended' | 'deleting' | (string & {});
|
|
422
496
|
/** RevokeReason is why an ApiKey stopped verifying. */
|
|
423
|
-
export type RevokeReason = 'user' | 'rotation' | 'leaked' | 'claimed' | 'claim_expired' | 'org_deleted' | 'admin' | (string & {});
|
|
497
|
+
export type RevokeReason = 'user' | 'rotation' | 'leaked' | 'claimed' | 'claim_expired' | 'org_deleted' | 'admin' | 'role_changed' | 'logout' | (string & {});
|
|
424
498
|
/**
|
|
425
|
-
* AccessService is Sylphx Access: orgs, projects, environments, and API keys
|
|
426
|
-
*
|
|
427
|
-
* only writer of these types.
|
|
499
|
+
* AccessService is Sylphx Access: orgs, projects, environments, and API keys.
|
|
500
|
+
* Access is the only writer of these types.
|
|
428
501
|
*
|
|
429
502
|
* Namespace of Sylphx Access on `Sylphx`.
|
|
430
503
|
*/
|
|
@@ -436,14 +509,15 @@ export declare class AccessApi {
|
|
|
436
509
|
readonly projects: ProjectsCollection;
|
|
437
510
|
/** The `envs` collection. */
|
|
438
511
|
readonly envs: EnvsCollection;
|
|
512
|
+
/** The `service_enablements` collection. */
|
|
513
|
+
readonly serviceEnablements: ServiceEnablementsCollection;
|
|
439
514
|
/** The `api_keys` collection. */
|
|
440
515
|
readonly apiKeys: ApiKeysCollection;
|
|
441
516
|
constructor(client: runtime.Client);
|
|
442
517
|
/**
|
|
443
518
|
* Returns the caller: the principal and the scope of the key or token that
|
|
444
519
|
* authenticated this request. Clients fill their org, project, and env
|
|
445
|
-
* defaults from it
|
|
446
|
-
* call it, whatever its scopes.
|
|
520
|
+
* defaults from it; every valid key may call it, whatever its scopes.
|
|
447
521
|
*
|
|
448
522
|
* `GET /v1/whoami` · permission `access:whoami` · effect `read`
|
|
449
523
|
*
|
|
@@ -593,6 +667,37 @@ export declare class EnvsCollection {
|
|
|
593
667
|
*/
|
|
594
668
|
delete(request: DeleteEnvironmentRequest): Promise<Record<string, never>>;
|
|
595
669
|
}
|
|
670
|
+
/** `service_enablements` of Sylphx Access: Resource type `access.sylphx.com/ServiceEnablement`. */
|
|
671
|
+
export declare class ServiceEnablementsCollection {
|
|
672
|
+
private readonly client;
|
|
673
|
+
constructor(client: runtime.Client);
|
|
674
|
+
/**
|
|
675
|
+
* Gets a service enablement.
|
|
676
|
+
*
|
|
677
|
+
* `GET /v1/{name=orgs/*\/projects/*\/service_enablements/*}` · permission `access:read` · effect `read`
|
|
678
|
+
*
|
|
679
|
+
* Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`.
|
|
680
|
+
*/
|
|
681
|
+
get(request: GetServiceEnablementRequest): Promise<ServiceEnablement>;
|
|
682
|
+
/**
|
|
683
|
+
* Lists the service enablements of a project, one per service.
|
|
684
|
+
*
|
|
685
|
+
* `GET /v1/{parent=orgs/*\/projects/*}/service_enablements` · permission `access:read` · effect `read`
|
|
686
|
+
*
|
|
687
|
+
* Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `PAGE_TOKEN_MISMATCH`.
|
|
688
|
+
*/
|
|
689
|
+
list(request: ListServiceEnablementsRequest): Promise<ListServiceEnablementsResponse>;
|
|
690
|
+
/** Every item of every page of `list`. */
|
|
691
|
+
listAll(request: ListServiceEnablementsRequest): AsyncGenerator<ServiceEnablement>;
|
|
692
|
+
/**
|
|
693
|
+
* Enables or disables a service on a project (`spec.enabled`).
|
|
694
|
+
*
|
|
695
|
+
* `PATCH /v1/{service_enablement.name=orgs/*\/projects/*\/service_enablements/*}` · permission `access:admin` · effect `write`
|
|
696
|
+
*
|
|
697
|
+
* Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `UNKNOWN_FIELD`, `INVALID_FIELD`, `ETAG_MISMATCH`, `IDEMPOTENCY_KEY_REUSED`, `IDEMPOTENCY_IN_PROGRESS`.
|
|
698
|
+
*/
|
|
699
|
+
update(request: UpdateServiceEnablementRequest): Promise<ServiceEnablement>;
|
|
700
|
+
}
|
|
596
701
|
/** `api_keys` of Sylphx Access: Resource type `access.sylphx.com/ApiKey`. */
|
|
597
702
|
export declare class ApiKeysCollection {
|
|
598
703
|
private readonly client;
|
|
@@ -606,7 +711,7 @@ export declare class ApiKeysCollection {
|
|
|
606
711
|
*/
|
|
607
712
|
get(request: GetApiKeyRequest): Promise<ApiKey>;
|
|
608
713
|
/**
|
|
609
|
-
* Lists API keys in an environment.
|
|
714
|
+
* Lists API keys in an environment, or the org-wide keys of an org.
|
|
610
715
|
*
|
|
611
716
|
* `GET /v1/{parent=orgs/*\/projects/*\/envs/*}/api_keys` · permission `access:read` · effect `read`
|
|
612
717
|
*
|
|
@@ -640,7 +745,8 @@ export declare class ApiKeysCollection {
|
|
|
640
745
|
*/
|
|
641
746
|
delete(request: DeleteApiKeyRequest): Promise<Record<string, never>>;
|
|
642
747
|
/**
|
|
643
|
-
* Revokes an API key immediately; revocation
|
|
748
|
+
* Revokes an API key immediately; revocation propagates on its own fast
|
|
749
|
+
* path, ahead of the bulk key data.
|
|
644
750
|
*
|
|
645
751
|
* `POST /v1/{name=orgs/*\/projects/*\/envs/*\/api_keys/*}:revoke` · permission `access:keys:write` · effect `destructive`
|
|
646
752
|
*
|
package/dist/access.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @generated by sylphx-gen 0.1.0 from contracts@
|
|
1
|
+
// @generated by sylphx-gen 0.1.0 from contracts@c8aac0afaf7591d0d5efa1ba6a8540d723d41a97ce7ad5d68601380ef3ab4783. Do not edit.
|
|
2
2
|
// `sylphx.access.v1`.
|
|
3
3
|
import * as runtime from './runtime.js';
|
|
4
4
|
import './common.js';
|
|
@@ -17,6 +17,8 @@ runtime.registerSchemas({
|
|
|
17
17
|
['revokeTime', 'revoke_time'],
|
|
18
18
|
['revokeReason', 'revoke_reason'],
|
|
19
19
|
['lastUseTime', 'last_use_time'],
|
|
20
|
+
['lastUseIp', 'last_use_ip'],
|
|
21
|
+
['roleBound', 'role_bound'],
|
|
20
22
|
],
|
|
21
23
|
'sylphx.access.v1.CreateApiKeyRequest': [
|
|
22
24
|
['apiKey', 'api_key', 'sylphx.access.v1.ApiKey'],
|
|
@@ -60,6 +62,7 @@ runtime.registerSchemas({
|
|
|
60
62
|
'sylphx.access.v1.GetEnvironmentRequest': [],
|
|
61
63
|
'sylphx.access.v1.GetOrgRequest': [],
|
|
62
64
|
'sylphx.access.v1.GetProjectRequest': [],
|
|
65
|
+
'sylphx.access.v1.GetServiceEnablementRequest': [],
|
|
63
66
|
'sylphx.access.v1.ListApiKeysRequest': [
|
|
64
67
|
['pageSize', 'page_size'],
|
|
65
68
|
['pageToken', 'page_token'],
|
|
@@ -96,6 +99,15 @@ runtime.registerSchemas({
|
|
|
96
99
|
['projects', 'projects', 'sylphx.access.v1.Project'],
|
|
97
100
|
['nextPageToken', 'next_page_token'],
|
|
98
101
|
],
|
|
102
|
+
'sylphx.access.v1.ListServiceEnablementsRequest': [
|
|
103
|
+
['pageSize', 'page_size'],
|
|
104
|
+
['pageToken', 'page_token'],
|
|
105
|
+
['orderBy', 'order_by'],
|
|
106
|
+
],
|
|
107
|
+
'sylphx.access.v1.ListServiceEnablementsResponse': [
|
|
108
|
+
['serviceEnablements', 'service_enablements', 'sylphx.access.v1.ServiceEnablement'],
|
|
109
|
+
['nextPageToken', 'next_page_token'],
|
|
110
|
+
],
|
|
99
111
|
'sylphx.access.v1.Org': [
|
|
100
112
|
['meta', 'meta', 'sylphx.common.v1.ResourceMeta'],
|
|
101
113
|
['spec', 'spec', 'sylphx.access.v1.OrgSpec'],
|
|
@@ -128,6 +140,16 @@ runtime.registerSchemas({
|
|
|
128
140
|
['gracePeriod', 'grace_period'],
|
|
129
141
|
['validateOnly', 'validate_only'],
|
|
130
142
|
],
|
|
143
|
+
'sylphx.access.v1.ServiceEnablement': [
|
|
144
|
+
['meta', 'meta', 'sylphx.common.v1.ResourceMeta'],
|
|
145
|
+
['spec', 'spec', 'sylphx.access.v1.ServiceEnablementSpec'],
|
|
146
|
+
['status', 'status', 'sylphx.access.v1.ServiceEnablementStatus'],
|
|
147
|
+
],
|
|
148
|
+
'sylphx.access.v1.ServiceEnablementSpec': [],
|
|
149
|
+
'sylphx.access.v1.ServiceEnablementStatus': [
|
|
150
|
+
['observedGeneration', 'observed_generation'],
|
|
151
|
+
['conditions', 'conditions', 'sylphx.common.v1.Condition'],
|
|
152
|
+
],
|
|
131
153
|
'sylphx.access.v1.UpdateApiKeyRequest': [
|
|
132
154
|
['apiKey', 'api_key', 'sylphx.access.v1.ApiKey'],
|
|
133
155
|
['updateMask', 'update_mask'],
|
|
@@ -148,6 +170,11 @@ runtime.registerSchemas({
|
|
|
148
170
|
['updateMask', 'update_mask'],
|
|
149
171
|
['validateOnly', 'validate_only'],
|
|
150
172
|
],
|
|
173
|
+
'sylphx.access.v1.UpdateServiceEnablementRequest': [
|
|
174
|
+
['serviceEnablement', 'service_enablement', 'sylphx.access.v1.ServiceEnablement'],
|
|
175
|
+
['updateMask', 'update_mask'],
|
|
176
|
+
['validateOnly', 'validate_only'],
|
|
177
|
+
],
|
|
151
178
|
'sylphx.access.v1.WhoamiRequest': [],
|
|
152
179
|
'sylphx.access.v1.WhoamiResponse': [
|
|
153
180
|
['apiKey', 'api_key'],
|
|
@@ -155,9 +182,8 @@ runtime.registerSchemas({
|
|
|
155
182
|
],
|
|
156
183
|
});
|
|
157
184
|
/**
|
|
158
|
-
* AccessService is Sylphx Access: orgs, projects, environments, and API keys
|
|
159
|
-
*
|
|
160
|
-
* only writer of these types.
|
|
185
|
+
* AccessService is Sylphx Access: orgs, projects, environments, and API keys.
|
|
186
|
+
* Access is the only writer of these types.
|
|
161
187
|
*
|
|
162
188
|
* Namespace of Sylphx Access on `Sylphx`.
|
|
163
189
|
*/
|
|
@@ -169,6 +195,8 @@ export class AccessApi {
|
|
|
169
195
|
projects;
|
|
170
196
|
/** The `envs` collection. */
|
|
171
197
|
envs;
|
|
198
|
+
/** The `service_enablements` collection. */
|
|
199
|
+
serviceEnablements;
|
|
172
200
|
/** The `api_keys` collection. */
|
|
173
201
|
apiKeys;
|
|
174
202
|
constructor(client) {
|
|
@@ -176,13 +204,13 @@ export class AccessApi {
|
|
|
176
204
|
this.orgs = new OrgsCollection(client);
|
|
177
205
|
this.projects = new ProjectsCollection(client);
|
|
178
206
|
this.envs = new EnvsCollection(client);
|
|
207
|
+
this.serviceEnablements = new ServiceEnablementsCollection(client);
|
|
179
208
|
this.apiKeys = new ApiKeysCollection(client);
|
|
180
209
|
}
|
|
181
210
|
/**
|
|
182
211
|
* Returns the caller: the principal and the scope of the key or token that
|
|
183
212
|
* authenticated this request. Clients fill their org, project, and env
|
|
184
|
-
* defaults from it
|
|
185
|
-
* call it, whatever its scopes.
|
|
213
|
+
* defaults from it; every valid key may call it, whatever its scopes.
|
|
186
214
|
*
|
|
187
215
|
* `GET /v1/whoami` · permission `access:whoami` · effect `read`
|
|
188
216
|
*
|
|
@@ -500,6 +528,73 @@ export class EnvsCollection {
|
|
|
500
528
|
});
|
|
501
529
|
}
|
|
502
530
|
}
|
|
531
|
+
/** `service_enablements` of Sylphx Access: Resource type `access.sylphx.com/ServiceEnablement`. */
|
|
532
|
+
export class ServiceEnablementsCollection {
|
|
533
|
+
client;
|
|
534
|
+
constructor(client) {
|
|
535
|
+
this.client = client;
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
538
|
+
* Gets a service enablement.
|
|
539
|
+
*
|
|
540
|
+
* `GET /v1/{name=orgs/*\/projects/*\/service_enablements/*}` · permission `access:read` · effect `read`
|
|
541
|
+
*
|
|
542
|
+
* Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`.
|
|
543
|
+
*/
|
|
544
|
+
async get(request) {
|
|
545
|
+
return this.client.call({
|
|
546
|
+
method: 'GET',
|
|
547
|
+
path: `/v1/${runtime.pathParam(request.name, 'orgs/*/projects/*/service_enablements/*', 'name')}`,
|
|
548
|
+
responseType: 'sylphx.access.v1.ServiceEnablement',
|
|
549
|
+
mutation: false,
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Lists the service enablements of a project, one per service.
|
|
554
|
+
*
|
|
555
|
+
* `GET /v1/{parent=orgs/*\/projects/*}/service_enablements` · permission `access:read` · effect `read`
|
|
556
|
+
*
|
|
557
|
+
* Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `INVALID_FIELD`, `PAGE_TOKEN_MISMATCH`.
|
|
558
|
+
*/
|
|
559
|
+
async list(request) {
|
|
560
|
+
return this.client.call({
|
|
561
|
+
method: 'GET',
|
|
562
|
+
path: `/v1/${runtime.pathParam(request.parent, 'orgs/*/projects/*', 'parent')}/service_enablements`,
|
|
563
|
+
query: { page_size: request.pageSize, page_token: request.pageToken, filter: request.filter, order_by: request.orderBy },
|
|
564
|
+
responseType: 'sylphx.access.v1.ListServiceEnablementsResponse',
|
|
565
|
+
mutation: false,
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
/** Every item of every page of `list`. */
|
|
569
|
+
async *listAll(request) {
|
|
570
|
+
let next = request;
|
|
571
|
+
for (;;) {
|
|
572
|
+
const page = await this.list(next);
|
|
573
|
+
yield* page.serviceEnablements ?? [];
|
|
574
|
+
if (page.nextPageToken === undefined || page.nextPageToken === '')
|
|
575
|
+
return;
|
|
576
|
+
next = { ...request, pageToken: page.nextPageToken };
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Enables or disables a service on a project (`spec.enabled`).
|
|
581
|
+
*
|
|
582
|
+
* `PATCH /v1/{service_enablement.name=orgs/*\/projects/*\/service_enablements/*}` · permission `access:admin` · effect `write`
|
|
583
|
+
*
|
|
584
|
+
* Errors: `UNAUTHENTICATED`, `PERMISSION_DENIED`, `RESOURCE_NOT_FOUND`, `UNKNOWN_FIELD`, `INVALID_FIELD`, `ETAG_MISMATCH`, `IDEMPOTENCY_KEY_REUSED`, `IDEMPOTENCY_IN_PROGRESS`.
|
|
585
|
+
*/
|
|
586
|
+
async update(request) {
|
|
587
|
+
return this.client.call({
|
|
588
|
+
method: 'PATCH',
|
|
589
|
+
path: `/v1/${runtime.pathParam(request.serviceEnablement?.name, 'orgs/*/projects/*/service_enablements/*', 'service_enablement.name')}`,
|
|
590
|
+
query: { update_mask: request.updateMask, validate_only: request.validateOnly },
|
|
591
|
+
body: request.serviceEnablement ?? {},
|
|
592
|
+
bodyType: 'sylphx.access.v1.ServiceEnablement',
|
|
593
|
+
responseType: 'sylphx.access.v1.ServiceEnablement',
|
|
594
|
+
mutation: true,
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
}
|
|
503
598
|
/** `api_keys` of Sylphx Access: Resource type `access.sylphx.com/ApiKey`. */
|
|
504
599
|
export class ApiKeysCollection {
|
|
505
600
|
client;
|
|
@@ -516,13 +611,13 @@ export class ApiKeysCollection {
|
|
|
516
611
|
async get(request) {
|
|
517
612
|
return this.client.call({
|
|
518
613
|
method: 'GET',
|
|
519
|
-
path: `/v1/${runtime.pathParam(request.name, 'orgs/*/projects/*/envs/*/api_keys/*', 'name')}`,
|
|
614
|
+
path: `/v1/${runtime.pathParam(request.name, 'orgs/*/projects/*/envs/*/api_keys/*|orgs/*/api_keys/*', 'name')}`,
|
|
520
615
|
responseType: 'sylphx.access.v1.ApiKey',
|
|
521
616
|
mutation: false,
|
|
522
617
|
});
|
|
523
618
|
}
|
|
524
619
|
/**
|
|
525
|
-
* Lists API keys in an environment.
|
|
620
|
+
* Lists API keys in an environment, or the org-wide keys of an org.
|
|
526
621
|
*
|
|
527
622
|
* `GET /v1/{parent=orgs/*\/projects/*\/envs/*}/api_keys` · permission `access:read` · effect `read`
|
|
528
623
|
*
|
|
@@ -531,7 +626,7 @@ export class ApiKeysCollection {
|
|
|
531
626
|
async list(request) {
|
|
532
627
|
return this.client.call({
|
|
533
628
|
method: 'GET',
|
|
534
|
-
path: `/v1/${runtime.pathParam(request.parent, 'orgs/*/projects/*/envs/*', 'parent')}/api_keys`,
|
|
629
|
+
path: `/v1/${runtime.pathParam(request.parent, 'orgs/*/projects/*/envs/*|orgs/*', 'parent')}/api_keys`,
|
|
535
630
|
query: { page_size: request.pageSize, page_token: request.pageToken, filter: request.filter, order_by: request.orderBy },
|
|
536
631
|
responseType: 'sylphx.access.v1.ListApiKeysResponse',
|
|
537
632
|
mutation: false,
|
|
@@ -558,7 +653,7 @@ export class ApiKeysCollection {
|
|
|
558
653
|
async create(request) {
|
|
559
654
|
return this.client.call({
|
|
560
655
|
method: 'POST',
|
|
561
|
-
path: `/v1/${runtime.pathParam(request.parent, 'orgs/*/projects/*/envs/*', 'parent')}/api_keys`,
|
|
656
|
+
path: `/v1/${runtime.pathParam(request.parent, 'orgs/*/projects/*/envs/*|orgs/*', 'parent')}/api_keys`,
|
|
562
657
|
query: { validate_only: request.validateOnly },
|
|
563
658
|
body: request.apiKey ?? {},
|
|
564
659
|
bodyType: 'sylphx.access.v1.ApiKey',
|
|
@@ -576,7 +671,7 @@ export class ApiKeysCollection {
|
|
|
576
671
|
async update(request) {
|
|
577
672
|
return this.client.call({
|
|
578
673
|
method: 'PATCH',
|
|
579
|
-
path: `/v1/${runtime.pathParam(request.apiKey?.name, 'orgs/*/projects/*/envs/*/api_keys/*', 'api_key.name')}`,
|
|
674
|
+
path: `/v1/${runtime.pathParam(request.apiKey?.name, 'orgs/*/projects/*/envs/*/api_keys/*|orgs/*/api_keys/*', 'api_key.name')}`,
|
|
580
675
|
query: { update_mask: request.updateMask, validate_only: request.validateOnly },
|
|
581
676
|
body: request.apiKey ?? {},
|
|
582
677
|
bodyType: 'sylphx.access.v1.ApiKey',
|
|
@@ -594,13 +689,14 @@ export class ApiKeysCollection {
|
|
|
594
689
|
async delete(request) {
|
|
595
690
|
return this.client.call({
|
|
596
691
|
method: 'DELETE',
|
|
597
|
-
path: `/v1/${runtime.pathParam(request.name, 'orgs/*/projects/*/envs/*/api_keys/*', 'name')}`,
|
|
692
|
+
path: `/v1/${runtime.pathParam(request.name, 'orgs/*/projects/*/envs/*/api_keys/*|orgs/*/api_keys/*', 'name')}`,
|
|
598
693
|
query: { etag: request.etag, validate_only: request.validateOnly },
|
|
599
694
|
mutation: true,
|
|
600
695
|
});
|
|
601
696
|
}
|
|
602
697
|
/**
|
|
603
|
-
* Revokes an API key immediately; revocation
|
|
698
|
+
* Revokes an API key immediately; revocation propagates on its own fast
|
|
699
|
+
* path, ahead of the bulk key data.
|
|
604
700
|
*
|
|
605
701
|
* `POST /v1/{name=orgs/*\/projects/*\/envs/*\/api_keys/*}:revoke` · permission `access:keys:write` · effect `destructive`
|
|
606
702
|
*
|
|
@@ -609,7 +705,7 @@ export class ApiKeysCollection {
|
|
|
609
705
|
async revoke(request) {
|
|
610
706
|
return this.client.call({
|
|
611
707
|
method: 'POST',
|
|
612
|
-
path: `/v1/${runtime.pathParam(request.name, 'orgs/*/projects/*/envs/*/api_keys/*', 'name')}:revoke`,
|
|
708
|
+
path: `/v1/${runtime.pathParam(request.name, 'orgs/*/projects/*/envs/*/api_keys/*|orgs/*/api_keys/*', 'name')}:revoke`,
|
|
613
709
|
body: runtime.omit(request, ['name']),
|
|
614
710
|
bodyType: 'sylphx.access.v1.RevokeApiKeyRequest',
|
|
615
711
|
responseType: 'sylphx.access.v1.ApiKey',
|
|
@@ -627,7 +723,7 @@ export class ApiKeysCollection {
|
|
|
627
723
|
async roll(request) {
|
|
628
724
|
return this.client.call({
|
|
629
725
|
method: 'POST',
|
|
630
|
-
path: `/v1/${runtime.pathParam(request.name, 'orgs/*/projects/*/envs/*/api_keys/*', 'name')}:roll`,
|
|
726
|
+
path: `/v1/${runtime.pathParam(request.name, 'orgs/*/projects/*/envs/*/api_keys/*|orgs/*/api_keys/*', 'name')}:roll`,
|
|
631
727
|
body: runtime.omit(request, ['name']),
|
|
632
728
|
bodyType: 'sylphx.access.v1.RollApiKeyRequest',
|
|
633
729
|
responseType: 'sylphx.access.v1.ApiKey',
|