@run402/sdk 1.51.1 → 1.53.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 +76 -27
- package/dist/index.d.ts +34 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -1
- package/dist/namespaces/projects.d.ts +14 -13
- package/dist/namespaces/projects.d.ts.map +1 -1
- package/dist/namespaces/projects.js +13 -34
- package/dist/namespaces/projects.js.map +1 -1
- package/dist/namespaces/projects.types.d.ts +0 -14
- package/dist/namespaces/projects.types.d.ts.map +1 -1
- package/dist/namespaces/sites.d.ts +7 -18
- package/dist/namespaces/sites.d.ts.map +1 -1
- package/dist/namespaces/sites.js +7 -14
- package/dist/namespaces/sites.js.map +1 -1
- package/dist/node/index.d.ts +4 -5
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +4 -5
- package/dist/node/index.js.map +1 -1
- package/dist/scoped.d.ts +248 -0
- package/dist/scoped.d.ts.map +1 -0
- package/dist/scoped.js +443 -0
- package/dist/scoped.js.map +1 -0
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -25,6 +25,19 @@ await r.blobs.put(project.project_id, "hello.txt", { content: "hi" });
|
|
|
25
25
|
|
|
26
26
|
That's it — credentials are read, x402 payments are signed, results are typed.
|
|
27
27
|
|
|
28
|
+
### Project-scoped sub-client
|
|
29
|
+
|
|
30
|
+
If you're working on a single project for the duration of a script, bind it once and skip the id arg on every call:
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
const p = await r.useProject(projectId); // persists active project + returns scoped handle
|
|
34
|
+
await p.blobs.put("hello.txt", { content: "hi" }); // no projectId arg
|
|
35
|
+
await p.functions.list();
|
|
36
|
+
await p.deploy.apply({ site: { replace: files({ "index.html": "<h1>hi</h1>" }) } });
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`r.useProject(id)` writes the active project to the keystore (shared with concurrent CLI runs). For transient in-script scoping that does NOT mutate that state, use `r.project(id)` (or `r.project()` with no arg to resolve from whatever the keystore currently considers active).
|
|
40
|
+
|
|
28
41
|
## Quick start (isomorphic)
|
|
29
42
|
|
|
30
43
|
```ts
|
|
@@ -45,38 +58,66 @@ The `CredentialsProvider` interface has two required methods (`getAuth`, `getPro
|
|
|
45
58
|
|
|
46
59
|
| Namespace | Highlights |
|
|
47
60
|
|---|---|
|
|
48
|
-
| `projects` | `provision`, `delete`, `list`, `getUsage`, `getSchema`, `info`, `keys`, `use`, `pin` |
|
|
49
|
-
| `deploy` | **The unified deploy primitive (v1.34+).** `apply` / `start` / `resume` / `status` / `getRelease` / `diff` / `plan` / `upload` / `commit` |
|
|
50
|
-
| `sites` | `
|
|
51
|
-
| `blobs` | `put` (returns `AssetRef` with `
|
|
52
|
-
| `functions` | `deploy`, `invoke`, `
|
|
61
|
+
| `projects` | `provision`, `delete`, `list`, `getUsage`, `getSchema`, `info`, `keys`, `use`, `active`, `pin`, `getQuote` |
|
|
62
|
+
| `deploy` | **The unified deploy primitive (v1.34+).** `apply` / `start` / `resume` / `status` / `list` / `events` / `getRelease` / `diff` / `plan` / `upload` / `commit` |
|
|
63
|
+
| `sites` | `deployDir` — Node entry only (`@run402/sdk/node`); thin wrapper over `r.deploy.apply` |
|
|
64
|
+
| `blobs` | `put` (returns `AssetRef` with `cdnUrl` / `sri` / `etag` / `cacheKind` and `scriptTag()`/`linkTag()`/`imgTag()` emitters), `get`, `ls`, `rm`, `sign`, `diagnoseUrl`, `waitFresh` |
|
|
65
|
+
| `functions` | `deploy`, `invoke`, `logs`, `update`, `list`, `delete` |
|
|
53
66
|
| `secrets` | `set`, `list`, `delete` |
|
|
54
|
-
| `subdomains` | `claim`, `list`, `delete` |
|
|
67
|
+
| `subdomains` | `claim`, `list`, `delete` (most agents declare subdomains in `r.deploy.apply({ subdomains: { set: [...] } })` instead) |
|
|
55
68
|
| `domains` | `add`, `list`, `status`, `remove` |
|
|
56
|
-
| `email` | `createMailbox`, `
|
|
69
|
+
| `email` | `createMailbox`, `getMailbox`, `deleteMailbox`, `send`, `list`, `get`, `getRaw`, `webhooks.*` |
|
|
57
70
|
| `senderDomain` | `register`, `status`, `remove`, `enableInbound`, `disableInbound` |
|
|
58
|
-
| `auth` | `
|
|
59
|
-
| `apps` | `browse`, `
|
|
60
|
-
| `tier` | `set`, `status
|
|
71
|
+
| `auth` | `requestMagicLink`, `verifyMagicLink`, `setUserPassword`, `settings`, `promote`, `demote` |
|
|
72
|
+
| `apps` | `browse`, `getApp`, `fork`, `publish`, `listVersions`, `updateVersion`, `deleteVersion`, `bundleDeploy` (legacy shim → routes through `deploy`) |
|
|
73
|
+
| `tier` | `set`, `status` (tier pricing lives on `r.projects.getQuote()`) |
|
|
61
74
|
| `billing` | `createEmailAccount`, `linkWallet`, `tierCheckout`, `buyEmailPack`, `setAutoRecharge`, `balance`, `history`, `createCheckout` |
|
|
62
|
-
| `contracts` | `provisionWallet`, `getWallet`, `listWallets`, `
|
|
63
|
-
| `ai` | `translate`, `moderate`, `usage` |
|
|
64
|
-
| `allowance` | `status`, `create`, `export`, `
|
|
75
|
+
| `contracts` | `provisionWallet`, `getWallet`, `listWallets`, `setRecovery`, `setLowBalanceAlert`, `call`, `read`, `callStatus`, `drain`, `deleteWallet` |
|
|
76
|
+
| `ai` | `translate`, `moderate`, `usage`, `generateImage` |
|
|
77
|
+
| `allowance` | `status`, `create`, `export`, `faucet` |
|
|
65
78
|
| `service` | `status`, `health` (no auth, no setup — works on a fresh install) |
|
|
66
79
|
| `admin` | Admin-only endpoints (pinning, lifecycle reactivation, dispute resolution) |
|
|
67
80
|
|
|
81
|
+
### Casing in returned shapes
|
|
82
|
+
|
|
83
|
+
Two casings coexist by design — agents reading the type surface should
|
|
84
|
+
classify a field by the SHAPE it belongs to:
|
|
85
|
+
|
|
86
|
+
- **Raw API result shapes preserve the gateway's snake_case fields.** Examples:
|
|
87
|
+
`ProvisionResult.project_id`, `ProvisionResult.anon_key`,
|
|
88
|
+
`ProvisionResult.service_key`, `ProvisionResult.schema_slot`,
|
|
89
|
+
`ProjectInfo.project_id`, `ProjectSummary.lease_expires_at`,
|
|
90
|
+
`UsageReport.api_calls`, `SchemaReport.schema`. These mirror the HTTP
|
|
91
|
+
response bodies one-to-one.
|
|
92
|
+
- **SDK-specific helper shapes use camelCase.** Examples:
|
|
93
|
+
`AssetRef.cdnUrl` / `AssetRef.cacheKind` / `AssetRef.contentSha256`,
|
|
94
|
+
`Run402DeployError.safeToRetry` / `operationId` / `mutationState`,
|
|
95
|
+
every `DeployEvent` variant's discriminator (`type`, plus per-variant
|
|
96
|
+
fields like `releaseId`, `urls`).
|
|
97
|
+
|
|
98
|
+
This split is intentional and stays through `1.x`. Doc examples in this
|
|
99
|
+
README and in `llms-sdk.txt` use the exact field names the types export —
|
|
100
|
+
copy them verbatim. CI fails any TypeScript-fenced example that accesses a
|
|
101
|
+
field that does not exist on the actual type.
|
|
102
|
+
|
|
103
|
+
> **Reference tables (in `llms-sdk.txt`) use plain code fences, not `ts`
|
|
104
|
+
> fences.** They document the type surface in compact form for visual
|
|
105
|
+
> scanning — they are not runnable programs and are exempt from CI
|
|
106
|
+
> type-checking. Runnable example snippets still use ```` ```ts ```` and are
|
|
107
|
+
> CI-gated against the published types.
|
|
108
|
+
|
|
68
109
|
## Patterns
|
|
69
110
|
|
|
70
111
|
### Paste-and-go assets — content-addressed URLs with SRI
|
|
71
112
|
|
|
72
|
-
`r.blobs.put` returns an `AssetRef`. The `
|
|
113
|
+
`r.blobs.put` returns an `AssetRef`. The `cdnUrl` is content-addressed (`pr-<public_id>.run402.com/_blob/<key>-<8hex>.<ext>`), served through CloudFront, and never needs cache invalidation. The browser refuses execution on byte mismatch via SRI:
|
|
73
114
|
|
|
74
115
|
```ts
|
|
75
116
|
const logo = await r.blobs.put(projectId, "logo.png", { bytes });
|
|
76
|
-
// logo.
|
|
77
|
-
// logo.sri
|
|
78
|
-
// logo.etag
|
|
79
|
-
// logo.
|
|
117
|
+
// logo.cdnUrl → drop into <img src="…">
|
|
118
|
+
// logo.sri → "sha256-…" for <script integrity="…">
|
|
119
|
+
// logo.etag → strong "sha256-<hex>"
|
|
120
|
+
// logo.cacheKind → "immutable" | "mutable" | "private"
|
|
80
121
|
```
|
|
81
122
|
|
|
82
123
|
`immutable: true` is the default since v1.45 — pass `false` only when you specifically want to skip the SHA-256 pass on a very large upload.
|
|
@@ -89,9 +130,9 @@ The canonical primitive for any deploy (database + migrations + manifest + secre
|
|
|
89
130
|
// One-shot — most agents use this.
|
|
90
131
|
const result = await r.deploy.apply(spec);
|
|
91
132
|
|
|
92
|
-
// Long-running with progress events.
|
|
133
|
+
// Long-running with progress events. Events are a discriminated union on `type`.
|
|
93
134
|
const op = await r.deploy.start(spec);
|
|
94
|
-
for await (const
|
|
135
|
+
for await (const ev of op.events()) console.log(ev.type);
|
|
95
136
|
const final = await op.result();
|
|
96
137
|
|
|
97
138
|
// Resume a previously-started deploy by id.
|
|
@@ -99,7 +140,7 @@ const resumed = await r.deploy.resume(operationId);
|
|
|
99
140
|
```
|
|
100
141
|
|
|
101
142
|
- **All bytes ride through CAS.** The plan request body never carries inline bytes — only `ContentRef` objects. When the spec exceeds 5 MB JSON, the SDK uploads the manifest itself as a CAS object (`manifest_ref` escape hatch).
|
|
102
|
-
- **
|
|
143
|
+
- **Per-resource semantics on the spec.** `site.replace` = "this is the whole site" (files absent are removed). `site.patch.put` / `patch.delete` are surgical updates. `functions.replace` / `functions.patch.set` / `functions.patch.delete` mirror that. `secrets.set` / `secrets.delete` / `secrets.replace_all` and `subdomains.set` / `subdomains.add` / `subdomains.remove` use their own shapes (see `ReleaseSpec` types). Top-level absence = leave untouched.
|
|
103
144
|
- **Server-authoritative manifest digest** — no byte-for-byte canonicalize requirement on the client.
|
|
104
145
|
- The Node entry adds `fileSetFromDir(path)` for filesystem byte sources:
|
|
105
146
|
|
|
@@ -107,9 +148,9 @@ const resumed = await r.deploy.resume(operationId);
|
|
|
107
148
|
import { run402, fileSetFromDir } from "@run402/sdk/node";
|
|
108
149
|
const r = run402();
|
|
109
150
|
await r.deploy.apply({
|
|
110
|
-
|
|
111
|
-
site: { replace:
|
|
112
|
-
subdomains: {
|
|
151
|
+
project: projectId,
|
|
152
|
+
site: { replace: await fileSetFromDir("./dist") },
|
|
153
|
+
subdomains: { set: ["my-app"] },
|
|
113
154
|
});
|
|
114
155
|
```
|
|
115
156
|
|
|
@@ -125,19 +166,27 @@ All failures throw subclasses of `Run402Error`:
|
|
|
125
166
|
| `ApiError` | Other non-2xx responses | `status`, `body` |
|
|
126
167
|
| `NetworkError` | Fetch rejected with no HTTP response | — |
|
|
127
168
|
| `LocalError` | Local-host issues (filesystem, signing) | — |
|
|
128
|
-
| `Run402DeployError` | Structured envelope from the deploy state machine (v1.34+) | `code`, `phase`, `
|
|
169
|
+
| `Run402DeployError` | Structured envelope from the deploy state machine (v1.34+) | `code`, `phase`, `operationId`, `safeToRetry`, `mutationState`, `nextActions` |
|
|
129
170
|
|
|
130
171
|
Branch on the structured fields, not English `message` text:
|
|
131
172
|
|
|
132
173
|
```ts
|
|
133
|
-
import {
|
|
174
|
+
import {
|
|
175
|
+
run402,
|
|
176
|
+
PaymentRequired,
|
|
177
|
+
Run402DeployError,
|
|
178
|
+
type ReleaseSpec,
|
|
179
|
+
} from "@run402/sdk/node";
|
|
180
|
+
|
|
181
|
+
declare const spec: ReleaseSpec;
|
|
182
|
+
const r = run402();
|
|
134
183
|
|
|
135
184
|
try {
|
|
136
185
|
await r.deploy.apply(spec);
|
|
137
186
|
} catch (e) {
|
|
138
187
|
if (e instanceof PaymentRequired) {
|
|
139
188
|
// present payment requirements to the user
|
|
140
|
-
} else if (e instanceof Run402DeployError && e.
|
|
189
|
+
} else if (e instanceof Run402DeployError && e.safeToRetry) {
|
|
141
190
|
// safe to retry — same idempotency key
|
|
142
191
|
} else throw e;
|
|
143
192
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ import { Contracts } from "./namespaces/contracts.js";
|
|
|
26
26
|
import { Admin } from "./namespaces/admin.js";
|
|
27
27
|
import { Deploy } from "./namespaces/deploy.js";
|
|
28
28
|
import type { ContentSource, FileSet } from "./namespaces/deploy.types.js";
|
|
29
|
+
import { ScopedRun402 } from "./scoped.js";
|
|
29
30
|
export interface Run402Options {
|
|
30
31
|
/** API base URL, e.g. `https://api.run402.com`. */
|
|
31
32
|
apiBase: string;
|
|
@@ -39,6 +40,7 @@ export interface Run402Options {
|
|
|
39
40
|
fetch?: typeof globalThis.fetch;
|
|
40
41
|
}
|
|
41
42
|
export declare class Run402 {
|
|
43
|
+
#private;
|
|
42
44
|
readonly projects: Projects;
|
|
43
45
|
readonly blobs: Blobs;
|
|
44
46
|
readonly functions: Functions;
|
|
@@ -59,6 +61,37 @@ export declare class Run402 {
|
|
|
59
61
|
readonly admin: Admin;
|
|
60
62
|
readonly deploy: Deploy;
|
|
61
63
|
constructor(opts: Run402Options);
|
|
64
|
+
/**
|
|
65
|
+
* Return a project-scoped sub-client where every project-id-bearing namespace
|
|
66
|
+
* method has the id pre-bound. Methods on the scoped client drop their
|
|
67
|
+
* `id`/`project_id`/`project` argument; caller-supplied values still win
|
|
68
|
+
* (so you can address a different project ad-hoc through a scoped handle).
|
|
69
|
+
*
|
|
70
|
+
* Resolution rules:
|
|
71
|
+
* - Explicit `id`: scope is bound to that id immediately. The keystore is
|
|
72
|
+
* NOT consulted at construction; the first method call that needs keys
|
|
73
|
+
* will throw `ProjectNotFound` if the id is unknown.
|
|
74
|
+
* - No argument: the SDK calls `credentials.getActiveProject()`. Throws
|
|
75
|
+
* `LocalError` (context: "scoping client to project") when the provider
|
|
76
|
+
* does not implement `getActiveProject` or returns `null`.
|
|
77
|
+
*
|
|
78
|
+
* `project()` does NOT mutate keystore state — use {@link useProject} for
|
|
79
|
+
* the persist-then-scope shorthand.
|
|
80
|
+
*/
|
|
81
|
+
project(id?: string): Promise<ScopedRun402>;
|
|
82
|
+
/**
|
|
83
|
+
* Persist `id` as the active project (via `r.projects.use(id)`) AND return a
|
|
84
|
+
* project-scoped sub-client in one call. Equivalent to:
|
|
85
|
+
*
|
|
86
|
+
* await r.projects.use(id);
|
|
87
|
+
* return r.project(id);
|
|
88
|
+
*
|
|
89
|
+
* Note: this mutates the credential provider's persistent active-project
|
|
90
|
+
* state (the keystore on Node). Concurrent CLI runs share that state. For
|
|
91
|
+
* transient in-script scoping that does not change the user's CLI default,
|
|
92
|
+
* use {@link project} instead.
|
|
93
|
+
*/
|
|
94
|
+
useProject(id: string): Promise<ScopedRun402>;
|
|
62
95
|
}
|
|
63
96
|
/**
|
|
64
97
|
* Build a `FileSet` from a path-keyed record of byte sources. A passthrough
|
|
@@ -87,5 +120,6 @@ export type { Run402DeployErrorCode, Run402DeployErrorFix, } from "./errors.js";
|
|
|
87
120
|
export type { CredentialsProvider, ProjectKeys } from "./credentials.js";
|
|
88
121
|
export type { RequestOptions, Client } from "./kernel.js";
|
|
89
122
|
export { Deploy } from "./namespaces/deploy.js";
|
|
123
|
+
export { ScopedRun402 } from "./scoped.js";
|
|
90
124
|
export type { ApplyOptions, CommitResponse, CommitStatus, ContentRef, ContentSource, DatabaseSpec, DeployDiff, DeployEvent, DeployOperation, DeployResult, ExposeManifest, FileSet, FsFileSource, FunctionSpec, FunctionsSpec, MigrationSpec, MissingContent, OperationSnapshot, OperationStatus, PaymentRequiredHint, PlanRequest, PlanResponse, ReleaseSpec, RouteSpec, SecretsSpec, SiteSpec, SmokeCheck, StartOptions, SubdomainsSpec, } from "./namespaces/deploy.types.js";
|
|
91
125
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA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,MAAM,CAElD;AAED,OAAO,EACL,WAAW,EACX,eAAe,EACf,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACzE,YAAY,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,YAAY,EACV,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,UAAU,EACV,aAAa,EACb,YAAY,EACZ,UAAU,EACV,WAAW,EACX,eAAe,EACf,YAAY,EACZ,cAAc,EACd,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,SAAS,EACT,WAAW,EACX,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,cAAc,GACf,MAAM,8BAA8B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -25,6 +25,8 @@ import { Email } from "./namespaces/email.js";
|
|
|
25
25
|
import { Contracts } from "./namespaces/contracts.js";
|
|
26
26
|
import { Admin } from "./namespaces/admin.js";
|
|
27
27
|
import { Deploy } from "./namespaces/deploy.js";
|
|
28
|
+
import { ScopedRun402 } from "./scoped.js";
|
|
29
|
+
import { LocalError } from "./errors.js";
|
|
28
30
|
export class Run402 {
|
|
29
31
|
projects;
|
|
30
32
|
blobs;
|
|
@@ -45,6 +47,7 @@ export class Run402 {
|
|
|
45
47
|
contracts;
|
|
46
48
|
admin;
|
|
47
49
|
deploy;
|
|
50
|
+
#client;
|
|
48
51
|
constructor(opts) {
|
|
49
52
|
const kernel = {
|
|
50
53
|
apiBase: opts.apiBase,
|
|
@@ -52,6 +55,7 @@ export class Run402 {
|
|
|
52
55
|
credentials: opts.credentials,
|
|
53
56
|
};
|
|
54
57
|
const client = buildClient(kernel);
|
|
58
|
+
this.#client = client;
|
|
55
59
|
this.projects = new Projects(client);
|
|
56
60
|
this.blobs = new Blobs(client);
|
|
57
61
|
this.functions = new Functions(client);
|
|
@@ -72,6 +76,54 @@ export class Run402 {
|
|
|
72
76
|
this.admin = new Admin(client);
|
|
73
77
|
this.deploy = new Deploy(client);
|
|
74
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Return a project-scoped sub-client where every project-id-bearing namespace
|
|
81
|
+
* method has the id pre-bound. Methods on the scoped client drop their
|
|
82
|
+
* `id`/`project_id`/`project` argument; caller-supplied values still win
|
|
83
|
+
* (so you can address a different project ad-hoc through a scoped handle).
|
|
84
|
+
*
|
|
85
|
+
* Resolution rules:
|
|
86
|
+
* - Explicit `id`: scope is bound to that id immediately. The keystore is
|
|
87
|
+
* NOT consulted at construction; the first method call that needs keys
|
|
88
|
+
* will throw `ProjectNotFound` if the id is unknown.
|
|
89
|
+
* - No argument: the SDK calls `credentials.getActiveProject()`. Throws
|
|
90
|
+
* `LocalError` (context: "scoping client to project") when the provider
|
|
91
|
+
* does not implement `getActiveProject` or returns `null`.
|
|
92
|
+
*
|
|
93
|
+
* `project()` does NOT mutate keystore state — use {@link useProject} for
|
|
94
|
+
* the persist-then-scope shorthand.
|
|
95
|
+
*/
|
|
96
|
+
async project(id) {
|
|
97
|
+
let resolvedId = id;
|
|
98
|
+
if (resolvedId === undefined) {
|
|
99
|
+
const getter = this.#client.credentials.getActiveProject;
|
|
100
|
+
if (!getter) {
|
|
101
|
+
throw new LocalError("r.project() with no id requires a credential provider that implements getActiveProject(). Pass an explicit id, or use @run402/sdk/node.", "scoping client to project");
|
|
102
|
+
}
|
|
103
|
+
const active = await getter.call(this.#client.credentials);
|
|
104
|
+
if (!active) {
|
|
105
|
+
throw new LocalError("No active project set. Call `r.projects.use(id)` (or `run402 projects use <id>`) to set one, or pass an explicit id to `r.project(id)`.", "scoping client to project");
|
|
106
|
+
}
|
|
107
|
+
resolvedId = active;
|
|
108
|
+
}
|
|
109
|
+
return new ScopedRun402(this, this.#client, resolvedId);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Persist `id` as the active project (via `r.projects.use(id)`) AND return a
|
|
113
|
+
* project-scoped sub-client in one call. Equivalent to:
|
|
114
|
+
*
|
|
115
|
+
* await r.projects.use(id);
|
|
116
|
+
* return r.project(id);
|
|
117
|
+
*
|
|
118
|
+
* Note: this mutates the credential provider's persistent active-project
|
|
119
|
+
* state (the keystore on Node). Concurrent CLI runs share that state. For
|
|
120
|
+
* transient in-script scoping that does not change the user's CLI default,
|
|
121
|
+
* use {@link project} instead.
|
|
122
|
+
*/
|
|
123
|
+
async useProject(id) {
|
|
124
|
+
await this.projects.use(id);
|
|
125
|
+
return this.project(id);
|
|
126
|
+
}
|
|
75
127
|
}
|
|
76
128
|
/**
|
|
77
129
|
* Build a `FileSet` from a path-keyed record of byte sources. A passthrough
|
|
@@ -101,4 +153,5 @@ export function run402(opts) {
|
|
|
101
153
|
}
|
|
102
154
|
export { Run402Error, PaymentRequired, ProjectNotFound, Unauthorized, ApiError, NetworkError, LocalError, Run402DeployError, } from "./errors.js";
|
|
103
155
|
export { Deploy } from "./namespaces/deploy.js";
|
|
156
|
+
export { ScopedRun402 } from "./scoped.js";
|
|
104
157
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAkC,MAAM,aAAa,CAAC;AAE1E,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,M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E,CAAC,CAAC;IAC1B,CAAC;CACF;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,KAAK,CAAC,MAAqC;IACzD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,MAAM,CAAC,IAAmB;IACxC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,OAAO,EACL,WAAW,EACX,eAAe,EACf,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAOrB,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* `projects` namespace — project lifecycle, introspection, and admin.
|
|
3
3
|
*
|
|
4
4
|
* Covers:
|
|
5
|
-
* - remote: provision, delete, list, getUsage, getSchema,
|
|
5
|
+
* - remote: provision, delete, list, getUsage, getSchema, pin, getQuote
|
|
6
6
|
* - local: info, keys, use (require provider support for persistence methods)
|
|
7
7
|
*/
|
|
8
8
|
import type { Client } from "../kernel.js";
|
|
9
9
|
import type { ProjectKeys } from "../credentials.js";
|
|
10
|
-
import type { ListProjectsResult, PinResult, ProjectInfo, ProvisionOptions, ProvisionResult, QuoteResult,
|
|
10
|
+
import type { ListProjectsResult, PinResult, ProjectInfo, ProvisionOptions, ProvisionResult, QuoteResult, SchemaReport, UsageReport } from "./projects.types.js";
|
|
11
11
|
export declare class Projects {
|
|
12
12
|
private readonly client;
|
|
13
13
|
constructor(client: Client);
|
|
@@ -54,17 +54,6 @@ export declare class Projects {
|
|
|
54
54
|
* constraints, and RLS policies.
|
|
55
55
|
*/
|
|
56
56
|
getSchema(id: string): Promise<SchemaReport>;
|
|
57
|
-
/**
|
|
58
|
-
* Apply a row-level-security template to one or more tables.
|
|
59
|
-
*
|
|
60
|
-
* ⚠ The gateway endpoint is deprecated (sunset 2026-05-23). Prefer the
|
|
61
|
-
* manifest-based `apply_expose` flow for new code.
|
|
62
|
-
*
|
|
63
|
-
* @throws {Run402Error} with `context: "setting up RLS"` when
|
|
64
|
-
* `i_understand_this_is_unrestricted` is missing for the
|
|
65
|
-
* `public_read_write_UNRESTRICTED` template.
|
|
66
|
-
*/
|
|
67
|
-
setupRls(id: string, opts: RlsSetupOptions): Promise<RlsSetupResult>;
|
|
68
57
|
/**
|
|
69
58
|
* Pin a project so it is not garbage-collected or expired.
|
|
70
59
|
*
|
|
@@ -98,6 +87,12 @@ export declare class Projects {
|
|
|
98
87
|
* Set the active/default project in local state. Requires the credential
|
|
99
88
|
* provider to support `setActiveProject`.
|
|
100
89
|
*
|
|
90
|
+
* Returns `void`. To both persist the active project AND get a project-scoped
|
|
91
|
+
* client in one call, use {@link Run402.useProject} instead:
|
|
92
|
+
*
|
|
93
|
+
* const p = await r.useProject("prj_xxx");
|
|
94
|
+
* await p.deploy.apply({ site: { ... } });
|
|
95
|
+
*
|
|
101
96
|
* @throws {ProjectNotFound} if the id is unknown to the provider.
|
|
102
97
|
* @throws {Error} if the provider does not support active-project state.
|
|
103
98
|
*/
|
|
@@ -105,6 +100,12 @@ export declare class Projects {
|
|
|
105
100
|
/**
|
|
106
101
|
* Return the active/default project id in local state, or null when none
|
|
107
102
|
* is set or the provider does not track active-project state.
|
|
103
|
+
*
|
|
104
|
+
* To resolve the active project AND build a scoped sub-client in one call,
|
|
105
|
+
* use {@link Run402.project} (no arg):
|
|
106
|
+
*
|
|
107
|
+
* const p = await r.project(); // throws if no active project is set
|
|
108
|
+
* await p.functions.list();
|
|
108
109
|
*/
|
|
109
110
|
active(): Promise<string | null>;
|
|
110
111
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../../src/namespaces/projects.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,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AAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAM5C;;;;;OAKG;IACG,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAM5C;;;;;;;;;;;;OAYG;IACG,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAapC;;;;;;;;;OASG;IACG,MAAM,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CAKvC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* `projects` namespace — project lifecycle, introspection, and admin.
|
|
3
3
|
*
|
|
4
4
|
* Covers:
|
|
5
|
-
* - remote: provision, delete, list, getUsage, getSchema,
|
|
5
|
+
* - remote: provision, delete, list, getUsage, getSchema, pin, getQuote
|
|
6
6
|
* - local: info, keys, use (require provider support for persistence methods)
|
|
7
7
|
*/
|
|
8
8
|
import { ProjectNotFound, Run402Error } from "../errors.js";
|
|
@@ -125,39 +125,6 @@ export class Projects {
|
|
|
125
125
|
context: "fetching schema",
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
|
-
/**
|
|
129
|
-
* Apply a row-level-security template to one or more tables.
|
|
130
|
-
*
|
|
131
|
-
* ⚠ The gateway endpoint is deprecated (sunset 2026-05-23). Prefer the
|
|
132
|
-
* manifest-based `apply_expose` flow for new code.
|
|
133
|
-
*
|
|
134
|
-
* @throws {Run402Error} with `context: "setting up RLS"` when
|
|
135
|
-
* `i_understand_this_is_unrestricted` is missing for the
|
|
136
|
-
* `public_read_write_UNRESTRICTED` template.
|
|
137
|
-
*/
|
|
138
|
-
async setupRls(id, opts) {
|
|
139
|
-
if (opts.template === "public_read_write_UNRESTRICTED" &&
|
|
140
|
-
opts.i_understand_this_is_unrestricted !== true) {
|
|
141
|
-
throw new (class extends Run402Error {
|
|
142
|
-
})("i_understand_this_is_unrestricted must be true when template is public_read_write_UNRESTRICTED", null, null, "setting up RLS");
|
|
143
|
-
}
|
|
144
|
-
const keys = await this.client.getProject(id);
|
|
145
|
-
if (!keys)
|
|
146
|
-
throw new ProjectNotFound(id, "setting up RLS");
|
|
147
|
-
const body = {
|
|
148
|
-
template: opts.template,
|
|
149
|
-
tables: opts.tables,
|
|
150
|
-
};
|
|
151
|
-
if (opts.i_understand_this_is_unrestricted !== undefined) {
|
|
152
|
-
body.i_understand_this_is_unrestricted = opts.i_understand_this_is_unrestricted;
|
|
153
|
-
}
|
|
154
|
-
return this.client.request(`/projects/v1/admin/${id}/rls`, {
|
|
155
|
-
method: "POST",
|
|
156
|
-
headers: { Authorization: `Bearer ${keys.service_key}` },
|
|
157
|
-
body,
|
|
158
|
-
context: "setting up RLS",
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
128
|
/**
|
|
162
129
|
* Pin a project so it is not garbage-collected or expired.
|
|
163
130
|
*
|
|
@@ -215,6 +182,12 @@ export class Projects {
|
|
|
215
182
|
* Set the active/default project in local state. Requires the credential
|
|
216
183
|
* provider to support `setActiveProject`.
|
|
217
184
|
*
|
|
185
|
+
* Returns `void`. To both persist the active project AND get a project-scoped
|
|
186
|
+
* client in one call, use {@link Run402.useProject} instead:
|
|
187
|
+
*
|
|
188
|
+
* const p = await r.useProject("prj_xxx");
|
|
189
|
+
* await p.deploy.apply({ site: { ... } });
|
|
190
|
+
*
|
|
218
191
|
* @throws {ProjectNotFound} if the id is unknown to the provider.
|
|
219
192
|
* @throws {Error} if the provider does not support active-project state.
|
|
220
193
|
*/
|
|
@@ -231,6 +204,12 @@ export class Projects {
|
|
|
231
204
|
/**
|
|
232
205
|
* Return the active/default project id in local state, or null when none
|
|
233
206
|
* is set or the provider does not track active-project state.
|
|
207
|
+
*
|
|
208
|
+
* To resolve the active project AND build a scoped sub-client in one call,
|
|
209
|
+
* use {@link Run402.project} (no arg):
|
|
210
|
+
*
|
|
211
|
+
* const p = await r.project(); // throws if no active project is set
|
|
212
|
+
* await p.functions.list();
|
|
234
213
|
*/
|
|
235
214
|
async active() {
|
|
236
215
|
const getter = this.client.credentials.getActiveProject;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projects.js","sourceRoot":"","sources":["../../src/namespaces/projects.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"projects.js","sourceRoot":"","sources":["../../src/namespaces/projects.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAY5D,MAAM,OAAO,QAAQ;IACU;IAA7B,YAA6B,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAE/C;;;;;;;;OAQG;IACH,KAAK,CAAC,SAAS,CAAC,OAAyB,EAAE;QACzC,MAAM,IAAI,GAA4B,EAAE,CAAC;QACzC,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS;YAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACnD,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS;YAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAEnD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAkB,cAAc,EAAE;YACxE,MAAM,EAAE,MAAM;YACd,IAAI;YACJ,OAAO,EAAE,sBAAsB;SAChC,CAAC,CAAC;QAEH,0EAA0E;QAC1E,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;QACtC,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC;YACtB,MAAM,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,UAAU,EAAE;gBACzC,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,WAAW,EAAE,MAAM,CAAC,WAAW;aAChC,CAAC,CAAC;QACL,CAAC;QACD,IAAI,KAAK,CAAC,gBAAgB,EAAE,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YG;IACH,KAAK,CAAC,GAAG,CAAC,EAAU;QAClB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QAC9C,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,eAAe,CAAC,EAAE,EAAE,wBAAwB,CAAC,CAAC;QAEnE,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC;QACxD,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CACb,4IAA4I,CAC7I,CAAC;QACJ,CAAC;QACD,MAAM,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACjD,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,MAAM;QACV,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC;QACxD,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QACzB,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAC9C,CAAC;CACF"}
|
|
@@ -83,20 +83,6 @@ export interface RlsTableSpec {
|
|
|
83
83
|
/** Column holding the owning user's id. Required when `template: "user_owns_rows"`. */
|
|
84
84
|
owner_column?: string;
|
|
85
85
|
}
|
|
86
|
-
export interface RlsSetupOptions {
|
|
87
|
-
template: RlsTemplate;
|
|
88
|
-
tables: RlsTableSpec[];
|
|
89
|
-
/**
|
|
90
|
-
* Required to be `true` when `template: "public_read_write_UNRESTRICTED"`.
|
|
91
|
-
* Acknowledges that the anon key gains INSERT/UPDATE/DELETE on the listed tables.
|
|
92
|
-
*/
|
|
93
|
-
i_understand_this_is_unrestricted?: boolean;
|
|
94
|
-
}
|
|
95
|
-
export interface RlsSetupResult {
|
|
96
|
-
status: string;
|
|
97
|
-
template: string;
|
|
98
|
-
tables: string[];
|
|
99
|
-
}
|
|
100
86
|
export interface PinResult {
|
|
101
87
|
status: string;
|
|
102
88
|
project_id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projects.types.d.ts","sourceRoot":"","sources":["../../src/namespaces/projects.types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;AAEzD,MAAM,WAAW,gBAAgB;IAC/B,+FAA+F;IAC/F,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,0DAA0D;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AAID,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,cAAc,EAAE,CAAC;CAC5B;AAID,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;CAChB;AAID,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,WAAW,EAAE,gBAAgB,EAAE,CAAC;IAChC,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,SAAS,EAAE,CAAC;CACvB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,WAAW,EAAE,CAAC;CACvB;AAID,MAAM,MAAM,WAAW,GACnB,gBAAgB,GAChB,iCAAiC,GACjC,gCAAgC,CAAC;AAErC,MAAM,WAAW,YAAY;IAC3B,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,uFAAuF;IACvF,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;
|
|
1
|
+
{"version":3,"file":"projects.types.d.ts","sourceRoot":"","sources":["../../src/namespaces/projects.types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,OAAO,GAAG,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-
* As of v1.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* As of v1.34 every static-site deploy flows through the unified
|
|
5
|
+
* {@link Deploy.apply} primitive. The legacy isomorphic surface is empty
|
|
6
|
+
* here; the Node-only `deployDir` convenience lives in
|
|
7
|
+
* {@link "../node/sites-node".NodeSites}.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* `SiteFile` is preserved for `apps.bundleDeploy` callers that still pass
|
|
10
|
+
* inline file bytes; the bundle shim translates these into a v2
|
|
11
|
+
* {@link ReleaseSpec} before dispatching.
|
|
12
12
|
*/
|
|
13
13
|
import type { Client } from "../kernel.js";
|
|
14
14
|
export interface SiteFile {
|
|
@@ -26,19 +26,8 @@ export interface SiteDeployResult {
|
|
|
26
26
|
/** Bytes uploaded in this deploy (0 on a no-op redeploy). */
|
|
27
27
|
bytes_uploaded?: number;
|
|
28
28
|
}
|
|
29
|
-
export interface DeploymentInfo {
|
|
30
|
-
id: string;
|
|
31
|
-
name: string;
|
|
32
|
-
url: string;
|
|
33
|
-
project_id?: string;
|
|
34
|
-
status: string;
|
|
35
|
-
files_count: number;
|
|
36
|
-
total_size: number;
|
|
37
|
-
}
|
|
38
29
|
export declare class Sites {
|
|
39
30
|
private readonly client;
|
|
40
31
|
constructor(client: Client);
|
|
41
|
-
/** Get deployment metadata by id. Public — no project auth. */
|
|
42
|
-
getDeployment(deploymentId: string): Promise<DeploymentInfo>;
|
|
43
32
|
}
|
|
44
33
|
//# sourceMappingURL=sites.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sites.d.ts","sourceRoot":"","sources":["../../src/namespaces/sites.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,WAAW,QAAQ;IACvB,sFAAsF;IACtF,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC/B;AAED,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,8EAA8E;IAC9E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6DAA6D;IAC7D,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,
|
|
1
|
+
{"version":3,"file":"sites.d.ts","sourceRoot":"","sources":["../../src/namespaces/sites.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,WAAW,QAAQ;IACvB,sFAAsF;IACtF,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC/B;AAED,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,8EAA8E;IAC9E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6DAA6D;IAC7D,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,qBAAa,KAAK;IACJ,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;CAC5C"}
|