@agentforge-io/sdk-console 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +150 -2
- package/dist/client.d.ts +43 -0
- package/dist/client.js +58 -0
- package/dist/errors.d.ts +25 -0
- package/dist/errors.js +93 -0
- package/dist/http.d.ts +70 -0
- package/dist/http.js +288 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +55 -0
- package/dist/resources/agents.d.ts +40 -0
- package/dist/resources/agents.js +67 -0
- package/dist/resources/apps.d.ts +16 -0
- package/dist/resources/apps.js +26 -0
- package/dist/resources/auth.d.ts +29 -0
- package/dist/resources/auth.js +57 -0
- package/dist/resources/connectors.d.ts +25 -0
- package/dist/resources/connectors.js +47 -0
- package/dist/resources/marketplace.d.ts +10 -0
- package/dist/resources/marketplace.js +14 -0
- package/dist/resources/members.d.ts +62 -0
- package/dist/resources/members.js +85 -0
- package/dist/resources/playground.d.ts +22 -0
- package/dist/resources/playground.js +32 -0
- package/dist/resources/teams.d.ts +49 -0
- package/dist/resources/teams.js +78 -0
- package/dist/resources/templates.d.ts +115 -0
- package/dist/resources/templates.js +187 -0
- package/dist/resources/tenants.d.ts +12 -0
- package/dist/resources/tenants.js +25 -0
- package/dist/resources/tools.d.ts +13 -0
- package/dist/resources/tools.js +17 -0
- package/dist/resources/variables.d.ts +28 -0
- package/dist/resources/variables.js +43 -0
- package/dist/token-store.d.ts +23 -0
- package/dist/token-store.js +27 -0
- package/dist/types.d.ts +1009 -0
- package/dist/types.js +19 -0
- package/package.json +44 -4
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// templates: gallery, detail, listing, version lifecycle (`client.templates`),
|
|
3
|
+
// plus the workspace-bound calls (`forTenant(id).templates`): install, save as
|
|
4
|
+
// template, publish a version, updates of installed teams.
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TenantTemplatesResource = exports.TemplatesResource = void 0;
|
|
7
|
+
const http_1 = require("../http");
|
|
8
|
+
function listQuery(input) {
|
|
9
|
+
return {
|
|
10
|
+
kind: input.kind,
|
|
11
|
+
q: input.q,
|
|
12
|
+
categories: input.categories,
|
|
13
|
+
primaryCategory: input.primaryCategory,
|
|
14
|
+
publisherAppId: input.publisherAppId,
|
|
15
|
+
limit: input.limit,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
class TemplatesResource {
|
|
19
|
+
constructor(http) {
|
|
20
|
+
this.http = http;
|
|
21
|
+
}
|
|
22
|
+
// ─── Public gallery (no session) ─────────────────────────────────────
|
|
23
|
+
/** `GET /public/templates`: system + public, listed rows only. */
|
|
24
|
+
async listPublic(input = {}) {
|
|
25
|
+
return this.http.request('GET', '/public/templates', { query: listQuery(input), auth: false });
|
|
26
|
+
}
|
|
27
|
+
/** `GET /public/templates/:id` (404 for tenant-private or unlisted rows). */
|
|
28
|
+
async getPublic(templateId) {
|
|
29
|
+
return this.http.request('GET', `/public/templates/${(0, http_1.seg)(templateId)}`, { auth: false });
|
|
30
|
+
}
|
|
31
|
+
// ─── Detail & listing ────────────────────────────────────────────────
|
|
32
|
+
/** `GET /templates/:id` (with payload). */
|
|
33
|
+
async get(templateId) {
|
|
34
|
+
return this.http.request('GET', `/templates/${(0, http_1.seg)(templateId)}`);
|
|
35
|
+
}
|
|
36
|
+
/** `PATCH /templates/:id`: metadata + listing (name, logo, cover, categories, guide, locale). */
|
|
37
|
+
async updateListing(templateId, patch) {
|
|
38
|
+
return this.http.request('PATCH', `/templates/${(0, http_1.seg)(templateId)}`, { body: patch });
|
|
39
|
+
}
|
|
40
|
+
/** `GET /templates/:id/policy-check`: dry run of an App's template policy against a version
|
|
41
|
+
* (default: open draft, else published). `publisherAppId` defaults to the template's own publisher. */
|
|
42
|
+
async policyCheck(templateId, input = {}) {
|
|
43
|
+
return this.http.request('GET', `/templates/${(0, http_1.seg)(templateId)}/policy-check`, {
|
|
44
|
+
query: { publisherAppId: input.publisherAppId, version: input.version },
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/** `POST /templates/:id/listing-assets/sign`: PUT the bytes to `uploadUrl`, then `updateListing({ logoUrl | coverUrl: publicUrl })`. */
|
|
48
|
+
async signListingAsset(templateId, input) {
|
|
49
|
+
return this.http.request('POST', `/templates/${(0, http_1.seg)(templateId)}/listing-assets/sign`, { body: input });
|
|
50
|
+
}
|
|
51
|
+
/** `GET /templates/:id/versions` (published snapshots). */
|
|
52
|
+
async listVersions(templateId) {
|
|
53
|
+
return this.http.request('GET', `/templates/${(0, http_1.seg)(templateId)}/versions`);
|
|
54
|
+
}
|
|
55
|
+
// ─── Version lifecycle (AGF-TEMPLATE-VERSIONS) ───────────────────────
|
|
56
|
+
/** `GET /templates/:id/version-history` */
|
|
57
|
+
async versionHistory(templateId) {
|
|
58
|
+
return this.http.request('GET', `/templates/${(0, http_1.seg)(templateId)}/version-history`);
|
|
59
|
+
}
|
|
60
|
+
/** `GET /templates/:id/diff?from=&to=`; `to: 'source'` compares with the live source team. */
|
|
61
|
+
async diff(templateId, from, to) {
|
|
62
|
+
return this.http.request('GET', `/templates/${(0, http_1.seg)(templateId)}/diff`, { query: { from, to } });
|
|
63
|
+
}
|
|
64
|
+
/** `POST /templates/:id/drafts`: snapshot the source team as a new draft version. */
|
|
65
|
+
async snapshotDraft(templateId) {
|
|
66
|
+
return this.http.request('POST', `/templates/${(0, http_1.seg)(templateId)}/drafts`, { body: {} });
|
|
67
|
+
}
|
|
68
|
+
/** `POST /templates/:id/versions/:v/submit`: draft -> in review. */
|
|
69
|
+
async submitVersion(templateId, version, changelog) {
|
|
70
|
+
return this.http.request('POST', `/templates/${(0, http_1.seg)(templateId)}/versions/${version}/submit`, {
|
|
71
|
+
body: { changelog },
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/** `POST /templates/:id/versions/:v/review` */
|
|
75
|
+
async reviewVersion(templateId, version, decision, comment) {
|
|
76
|
+
return this.http.request('POST', `/templates/${(0, http_1.seg)(templateId)}/versions/${version}/review`, {
|
|
77
|
+
body: { decision, comment },
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/** `POST /templates/:id/versions/:v/publish` */
|
|
81
|
+
async publishVersion(templateId, version, changelog) {
|
|
82
|
+
return this.http.request('POST', `/templates/${(0, http_1.seg)(templateId)}/versions/${version}/publish`, {
|
|
83
|
+
body: { changelog },
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/** `DELETE /templates/:id/versions/:v`: discard a draft. */
|
|
87
|
+
async discardVersion(templateId, version) {
|
|
88
|
+
return this.http.request('DELETE', `/templates/${(0, http_1.seg)(templateId)}/versions/${version}`);
|
|
89
|
+
}
|
|
90
|
+
/** `POST /templates/:id/versions/:v/restore`: new draft from an old version. */
|
|
91
|
+
async restoreVersion(templateId, version) {
|
|
92
|
+
return this.http.request('POST', `/templates/${(0, http_1.seg)(templateId)}/versions/${version}/restore`, { body: {} });
|
|
93
|
+
}
|
|
94
|
+
/** `PUT /templates/:id/source`: make a team of the template's workspace its source. */
|
|
95
|
+
async linkSource(templateId, teamId) {
|
|
96
|
+
return this.http.request('PUT', `/templates/${(0, http_1.seg)(templateId)}/source`, { body: { teamId } });
|
|
97
|
+
}
|
|
98
|
+
/** `DELETE /templates/:id/source` */
|
|
99
|
+
async unlinkSource(templateId) {
|
|
100
|
+
return this.http.request('DELETE', `/templates/${(0, http_1.seg)(templateId)}/source`);
|
|
101
|
+
}
|
|
102
|
+
/** `POST /templates/:id/source/copy`: create the editable copy from the published version and link it. */
|
|
103
|
+
async createSourceCopy(templateId) {
|
|
104
|
+
return this.http.request('POST', `/templates/${(0, http_1.seg)(templateId)}/source/copy`, { body: {} });
|
|
105
|
+
}
|
|
106
|
+
/** `PATCH /templates/:id/review-policy` */
|
|
107
|
+
async setReviewPolicy(templateId, policy) {
|
|
108
|
+
return this.http.request('PATCH', `/templates/${(0, http_1.seg)(templateId)}/review-policy`, { body: policy });
|
|
109
|
+
}
|
|
110
|
+
// ─── Business settings the template asks for ─────────────────────────
|
|
111
|
+
/** `GET /templates/:id/config-fields` (open draft, else published). */
|
|
112
|
+
async configFields(templateId) {
|
|
113
|
+
return this.http.request('GET', `/templates/${(0, http_1.seg)(templateId)}/config-fields`);
|
|
114
|
+
}
|
|
115
|
+
/** `PUT /templates/:id/config-fields` (saved on the open draft). 400 `invalid_config_schema` if malformed. */
|
|
116
|
+
async setConfigFields(templateId, configSchema) {
|
|
117
|
+
return this.http.request('PUT', `/templates/${(0, http_1.seg)(templateId)}/config-fields`, { body: { configSchema } });
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
exports.TemplatesResource = TemplatesResource;
|
|
121
|
+
/** `forTenant(id).templates`: everything of `client.templates` plus the workspace-bound calls. */
|
|
122
|
+
class TenantTemplatesResource extends TemplatesResource {
|
|
123
|
+
constructor(http, tenantId) {
|
|
124
|
+
super(http);
|
|
125
|
+
this.tenantId = tenantId;
|
|
126
|
+
}
|
|
127
|
+
get tenantBase() {
|
|
128
|
+
return `/admin/tenants/${(0, http_1.seg)(this.tenantId)}`;
|
|
129
|
+
}
|
|
130
|
+
/** `GET /templates?tenantId=`: system + public + this workspace's own. */
|
|
131
|
+
async list(input = {}) {
|
|
132
|
+
return this.http.request('GET', '/templates', { query: { tenantId: this.tenantId, ...listQuery(input) } });
|
|
133
|
+
}
|
|
134
|
+
/** `POST /templates/:id/install` into this workspace. */
|
|
135
|
+
async install(templateId, input = {}) {
|
|
136
|
+
return this.http.request('POST', `/templates/${(0, http_1.seg)(templateId)}/install`, {
|
|
137
|
+
body: { destinationTenantId: this.tenantId, ...input },
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
/** `GET /templates/:id/install-readiness?destinationTenantId=`: what is ready / needs setup before installing here. */
|
|
141
|
+
async installReadiness(templateId) {
|
|
142
|
+
return this.http.request('GET', `/templates/${(0, http_1.seg)(templateId)}/install-readiness`, {
|
|
143
|
+
query: { destinationTenantId: this.tenantId },
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
/** `POST /admin/tenants/:tenantId/agents/:agentId/save-as-template` */
|
|
147
|
+
async saveAgentAsTemplate(agentId, input = {}) {
|
|
148
|
+
return this.http.request('POST', `${this.tenantBase}/agents/${(0, http_1.seg)(agentId)}/save-as-template`, { body: input });
|
|
149
|
+
}
|
|
150
|
+
/** `POST /admin/tenants/:tenantId/teams/:teamId/save-as-template` */
|
|
151
|
+
async saveTeamAsTemplate(teamId, input = {}) {
|
|
152
|
+
return this.http.request('POST', `${this.tenantBase}/teams/${(0, http_1.seg)(teamId)}/save-as-template`, { body: input });
|
|
153
|
+
}
|
|
154
|
+
/** `POST /admin/tenants/:tenantId/agents/:agentId/publish-template-version` */
|
|
155
|
+
async publishAgentTemplateVersion(agentId, input) {
|
|
156
|
+
return this.http.request('POST', `${this.tenantBase}/agents/${(0, http_1.seg)(agentId)}/publish-template-version`, {
|
|
157
|
+
body: input,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
/** `POST /admin/tenants/:tenantId/teams/:teamId/publish-template-version` */
|
|
161
|
+
async publishTeamTemplateVersion(teamId, input) {
|
|
162
|
+
return this.http.request('POST', `${this.tenantBase}/teams/${(0, http_1.seg)(teamId)}/publish-template-version`, {
|
|
163
|
+
body: input,
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
/** `GET /admin/tenants/:tenantId/teams/:teamId/template-source`: the template this team is the source of, with its version state. */
|
|
167
|
+
async templateSource(teamId) {
|
|
168
|
+
return this.http.request('GET', `${this.tenantBase}/teams/${(0, http_1.seg)(teamId)}/template-source`);
|
|
169
|
+
}
|
|
170
|
+
/** `GET /me/template-updates-available?tenantId=`: installed agents/teams behind their template. */
|
|
171
|
+
async updatesAvailable() {
|
|
172
|
+
return this.http.request('GET', '/me/template-updates-available', { query: { tenantId: this.tenantId } });
|
|
173
|
+
}
|
|
174
|
+
/** `POST /admin/tenants/:tenantId/teams/:teamId/update-from-template` */
|
|
175
|
+
async updateTeamFromTemplate(teamId, input = {}) {
|
|
176
|
+
return this.http.request('POST', `${this.tenantBase}/teams/${(0, http_1.seg)(teamId)}/update-from-template`, {
|
|
177
|
+
body: input,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
/** `POST /admin/tenants/:tenantId/agents/:agentId/update-from-template` */
|
|
181
|
+
async updateAgentFromTemplate(agentId, input = {}) {
|
|
182
|
+
return this.http.request('POST', `${this.tenantBase}/agents/${(0, http_1.seg)(agentId)}/update-from-template`, {
|
|
183
|
+
body: input,
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
exports.TenantTemplatesResource = TenantTemplatesResource;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { HttpCore } from '../http';
|
|
2
|
+
import type { CreateTenantInput, ListTenantsInput, Tenant, TenantList, UpdateTenantInput } from '../types';
|
|
3
|
+
export declare class TenantsResource {
|
|
4
|
+
private readonly http;
|
|
5
|
+
constructor(http: HttpCore);
|
|
6
|
+
/** `GET /me/tenants` */
|
|
7
|
+
listMine(input?: ListTenantsInput): Promise<TenantList>;
|
|
8
|
+
/** `POST /admin/tenants`. The caller becomes the owner. */
|
|
9
|
+
create(input: CreateTenantInput): Promise<Tenant>;
|
|
10
|
+
/** `PATCH /admin/tenants/:tenantId` */
|
|
11
|
+
update(tenantId: string, patch: UpdateTenantInput): Promise<Tenant>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// tenants: the user's workspaces. `GET /me/tenants` (owned + member, with
|
|
3
|
+
// `myRole`) feeds the switcher. The server has no `GET /admin/tenants/:id`:
|
|
4
|
+
// read one from `listMine`.
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TenantsResource = void 0;
|
|
7
|
+
const http_1 = require("../http");
|
|
8
|
+
class TenantsResource {
|
|
9
|
+
constructor(http) {
|
|
10
|
+
this.http = http;
|
|
11
|
+
}
|
|
12
|
+
/** `GET /me/tenants` */
|
|
13
|
+
async listMine(input = {}) {
|
|
14
|
+
return this.http.request('GET', '/me/tenants', { query: { ...input } });
|
|
15
|
+
}
|
|
16
|
+
/** `POST /admin/tenants`. The caller becomes the owner. */
|
|
17
|
+
async create(input) {
|
|
18
|
+
return this.http.request('POST', '/admin/tenants', { body: input });
|
|
19
|
+
}
|
|
20
|
+
/** `PATCH /admin/tenants/:tenantId` */
|
|
21
|
+
async update(tenantId, patch) {
|
|
22
|
+
return this.http.request('PATCH', `/admin/tenants/${(0, http_1.seg)(tenantId)}`, { body: patch });
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.TenantsResource = TenantsResource;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { HttpCore } from '../http';
|
|
2
|
+
import type { ToolGroup } from '../types';
|
|
3
|
+
export declare class ToolsResource {
|
|
4
|
+
private readonly http;
|
|
5
|
+
private readonly tenantId;
|
|
6
|
+
constructor(http: HttpCore, tenantId: string);
|
|
7
|
+
/** `GET /tools/grouped?tenantId=&q=` */
|
|
8
|
+
grouped(input?: {
|
|
9
|
+
q?: string;
|
|
10
|
+
}): Promise<{
|
|
11
|
+
groups: ToolGroup[];
|
|
12
|
+
}>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// tools: the tool catalog, grouped by source (connector / MCP / built-in).
|
|
3
|
+
// `forTenant(id).tools`. Feeds the agent editor's tool picker.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.ToolsResource = void 0;
|
|
6
|
+
class ToolsResource {
|
|
7
|
+
constructor(http, tenantId) {
|
|
8
|
+
this.http = http;
|
|
9
|
+
this.tenantId = tenantId;
|
|
10
|
+
}
|
|
11
|
+
/** `GET /tools/grouped?tenantId=&q=` */
|
|
12
|
+
async grouped(input = {}) {
|
|
13
|
+
const q = input.q?.trim();
|
|
14
|
+
return this.http.request('GET', '/tools/grouped', { query: { tenantId: this.tenantId, q: q || undefined } });
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.ToolsResource = ToolsResource;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { HttpCore } from '../http';
|
|
2
|
+
import type { TenantVariable, UpsertTenantVariableInput } from '../types';
|
|
3
|
+
export declare class VariablesResource {
|
|
4
|
+
private readonly http;
|
|
5
|
+
private readonly tenantId;
|
|
6
|
+
constructor(http: HttpCore, tenantId: string);
|
|
7
|
+
private get base();
|
|
8
|
+
/** `GET /tenants/:tenantId/variables?q=`. Members get config variables
|
|
9
|
+
* (with `value`); owner/admin also get secrets (`valueHint` only). */
|
|
10
|
+
list(input?: {
|
|
11
|
+
q?: string;
|
|
12
|
+
}): Promise<{
|
|
13
|
+
items: TenantVariable[];
|
|
14
|
+
}>;
|
|
15
|
+
/** `GET .../variables/:key` (same visibility as the list; 404 when absent). */
|
|
16
|
+
get(key: string): Promise<TenantVariable>;
|
|
17
|
+
/** `PUT .../variables/:key`. Owner/admin only. `kind` omitted keeps the
|
|
18
|
+
* current kind (new variables default to `secret`); turning an existing
|
|
19
|
+
* secret into config is a 409 `variable_kind_conflict`. `value` is a
|
|
20
|
+
* non-empty string of at most 10 000 characters. Resolves to the stored
|
|
21
|
+
* entry: a secret comes back as a hint, never the value. */
|
|
22
|
+
upsert(key: string, input: UpsertTenantVariableInput): Promise<TenantVariable>;
|
|
23
|
+
/** `DELETE .../variables/:key`. Owner/admin only. 409 `has_bindings`
|
|
24
|
+
* (details.bindings) unless `force`. */
|
|
25
|
+
remove(key: string, options?: {
|
|
26
|
+
force?: boolean;
|
|
27
|
+
}): Promise<void>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Workspace variables (`forTenant(id).variables`): business data a template
|
|
3
|
+
// reads through `{{config:KEY}}` (config, readable) or `{{secret:KEY}}`
|
|
4
|
+
// (secret, write-only: the platform only ever returns a 4-char hint).
|
|
5
|
+
// Server: `TenantVariablesController` at `/tenants/:tenantId/variables`
|
|
6
|
+
// (no `admin/` prefix: plain members read config).
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.VariablesResource = void 0;
|
|
9
|
+
const http_1 = require("../http");
|
|
10
|
+
class VariablesResource {
|
|
11
|
+
constructor(http, tenantId) {
|
|
12
|
+
this.http = http;
|
|
13
|
+
this.tenantId = tenantId;
|
|
14
|
+
}
|
|
15
|
+
get base() {
|
|
16
|
+
return `/tenants/${(0, http_1.seg)(this.tenantId)}/variables`;
|
|
17
|
+
}
|
|
18
|
+
/** `GET /tenants/:tenantId/variables?q=`. Members get config variables
|
|
19
|
+
* (with `value`); owner/admin also get secrets (`valueHint` only). */
|
|
20
|
+
async list(input = {}) {
|
|
21
|
+
return this.http.request('GET', this.base, { query: { q: input.q } });
|
|
22
|
+
}
|
|
23
|
+
/** `GET .../variables/:key` (same visibility as the list; 404 when absent). */
|
|
24
|
+
async get(key) {
|
|
25
|
+
return this.http.request('GET', `${this.base}/${(0, http_1.seg)(key)}`);
|
|
26
|
+
}
|
|
27
|
+
/** `PUT .../variables/:key`. Owner/admin only. `kind` omitted keeps the
|
|
28
|
+
* current kind (new variables default to `secret`); turning an existing
|
|
29
|
+
* secret into config is a 409 `variable_kind_conflict`. `value` is a
|
|
30
|
+
* non-empty string of at most 10 000 characters. Resolves to the stored
|
|
31
|
+
* entry: a secret comes back as a hint, never the value. */
|
|
32
|
+
async upsert(key, input) {
|
|
33
|
+
return this.http.request('PUT', `${this.base}/${(0, http_1.seg)(key)}`, { body: input });
|
|
34
|
+
}
|
|
35
|
+
/** `DELETE .../variables/:key`. Owner/admin only. 409 `has_bindings`
|
|
36
|
+
* (details.bindings) unless `force`. */
|
|
37
|
+
async remove(key, options = {}) {
|
|
38
|
+
await this.http.request('DELETE', `${this.base}/${(0, http_1.seg)(key)}`, {
|
|
39
|
+
query: { force: options.force ? true : undefined },
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.VariablesResource = VariablesResource;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type MaybePromise<T> = T | Promise<T>;
|
|
2
|
+
export interface AuthTokens {
|
|
3
|
+
accessToken: string;
|
|
4
|
+
refreshToken: string;
|
|
5
|
+
}
|
|
6
|
+
export interface TokenStore {
|
|
7
|
+
getAccessToken(): MaybePromise<string | null>;
|
|
8
|
+
getRefreshToken(): MaybePromise<string | null>;
|
|
9
|
+
/** Persist a fresh pair (login, register, invite accept, refresh rotation). */
|
|
10
|
+
setTokens(tokens: AuthTokens): MaybePromise<void>;
|
|
11
|
+
/** Wipe both tokens (sign out). */
|
|
12
|
+
clear(): MaybePromise<void>;
|
|
13
|
+
}
|
|
14
|
+
/** In-memory store: tests, SSR, or an app that does not persist the session. */
|
|
15
|
+
export declare class MemoryTokenStore implements TokenStore {
|
|
16
|
+
private access;
|
|
17
|
+
private refresh;
|
|
18
|
+
constructor(initial?: Partial<AuthTokens>);
|
|
19
|
+
getAccessToken(): string | null;
|
|
20
|
+
getRefreshToken(): string | null;
|
|
21
|
+
setTokens(tokens: AuthTokens): void;
|
|
22
|
+
clear(): void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Where the session tokens live. The app plugs its own storage: SecureStore on
|
|
3
|
+
// native, localStorage / memory on web. Every method may be sync or async.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.MemoryTokenStore = void 0;
|
|
6
|
+
/** In-memory store: tests, SSR, or an app that does not persist the session. */
|
|
7
|
+
class MemoryTokenStore {
|
|
8
|
+
constructor(initial) {
|
|
9
|
+
this.access = initial?.accessToken ?? null;
|
|
10
|
+
this.refresh = initial?.refreshToken ?? null;
|
|
11
|
+
}
|
|
12
|
+
getAccessToken() {
|
|
13
|
+
return this.access;
|
|
14
|
+
}
|
|
15
|
+
getRefreshToken() {
|
|
16
|
+
return this.refresh;
|
|
17
|
+
}
|
|
18
|
+
setTokens(tokens) {
|
|
19
|
+
this.access = tokens.accessToken;
|
|
20
|
+
this.refresh = tokens.refreshToken;
|
|
21
|
+
}
|
|
22
|
+
clear() {
|
|
23
|
+
this.access = null;
|
|
24
|
+
this.refresh = null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.MemoryTokenStore = MemoryTokenStore;
|