@aglyn/aglyn 1.15.0 → 1.15.1
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/package.json +11 -11
- package/src/lib/app-utils/buy-now-pay-later.d.ts +45 -0
- package/src/lib/app-utils/buy-now-pay-later.js +68 -0
- package/src/lib/app-utils/buy-now-pay-later.js.map +1 -0
- package/src/lib/app-utils/contexts.d.ts +1 -0
- package/src/lib/app-utils/contexts.js +1 -0
- package/src/lib/app-utils/contexts.js.map +1 -1
- package/src/lib/app-utils/docs-help-sections.generated.js +2 -0
- package/src/lib/app-utils/docs-help-sections.generated.js.map +1 -1
- package/src/lib/app-utils/docs-help.generated.d.ts +3 -3
- package/src/lib/app-utils/docs-help.generated.js +9 -0
- package/src/lib/app-utils/docs-help.generated.js.map +1 -1
- package/src/lib/app-utils/docs-index.generated.js +4 -4
- package/src/lib/app-utils/docs-index.generated.js.map +1 -1
- package/src/lib/app-utils/plan-entitlements.d.ts +127 -75
- package/src/lib/app-utils/plan-entitlements.js +120 -77
- package/src/lib/app-utils/plan-entitlements.js.map +1 -1
- package/src/lib/app-utils/plugin-bundle-checks.d.ts +14 -2
- package/src/lib/app-utils/plugin-bundle-checks.js +82 -7
- package/src/lib/app-utils/plugin-bundle-checks.js.map +1 -1
- package/src/lib/app-utils/plugin-connection-editor.d.ts +48 -0
- package/src/lib/app-utils/plugin-connection-editor.js +46 -0
- package/src/lib/app-utils/plugin-connection-editor.js.map +1 -0
- package/src/lib/app-utils/plugin-connection-record.d.ts +42 -0
- package/src/lib/app-utils/plugin-connection-record.js +48 -0
- package/src/lib/app-utils/plugin-connection-record.js.map +1 -0
- package/src/lib/app-utils/plugin-connection-records-context.d.ts +23 -0
- package/src/lib/app-utils/plugin-connection-records-context.js +29 -0
- package/src/lib/app-utils/plugin-connection-records-context.js.map +1 -0
- package/src/lib/app-utils/plugin-connection-records.d.ts +42 -0
- package/src/lib/app-utils/plugin-connection-records.js +56 -0
- package/src/lib/app-utils/plugin-connection-records.js.map +1 -0
- package/src/lib/app-utils/plugin-connections.d.ts +320 -0
- package/src/lib/app-utils/plugin-connections.js +895 -0
- package/src/lib/app-utils/plugin-connections.js.map +1 -0
- package/src/lib/app-utils/plugin-elements.d.ts +104 -0
- package/src/lib/app-utils/plugin-elements.js +128 -0
- package/src/lib/app-utils/plugin-elements.js.map +1 -0
- package/src/lib/app-utils/plugin-manifest.d.ts +20 -75
- package/src/lib/app-utils/plugin-manifest.js +65 -100
- package/src/lib/app-utils/plugin-manifest.js.map +1 -1
- package/src/lib/app-utils/realm-elements-context.d.ts +16 -0
- package/src/lib/app-utils/realm-elements-context.js +16 -0
- package/src/lib/app-utils/realm-elements-context.js.map +1 -1
- package/src/lib/app-utils/realm-host-surface.generated.js +1 -0
- package/src/lib/app-utils/realm-host-surface.generated.js.map +1 -1
- package/src/lib/app-utils/release-flags.d.ts +1 -1
- package/src/lib/app-utils/release-flags.js +11 -0
- package/src/lib/app-utils/release-flags.js.map +1 -1
- package/src/lib/app-utils/server.d.ts +1 -0
- package/src/lib/app-utils/server.js +2 -0
- package/src/lib/app-utils/server.js.map +1 -1
- package/src/lib/plugin-manager/feature-plugins.d.ts +25 -0
- package/src/lib/plugin-manager/feature-plugins.js +10 -0
- package/src/lib/plugin-manager/feature-plugins.js.map +1 -1
- package/src/lib/plugin-manager/first-party-plugins.generated.js +11 -0
- package/src/lib/plugin-manager/first-party-plugins.generated.js.map +1 -1
- package/src/lib/plugin-manager/index.d.ts +1 -0
- package/src/lib/plugin-manager/index.js +1 -0
- package/src/lib/plugin-manager/index.js.map +1 -1
- package/src/lib/plugin-manager/plugin-artifact-inventory.d.ts +5 -0
- package/src/lib/plugin-manager/plugin-artifact-inventory.js.map +1 -1
- package/src/lib/plugin-manager/plugin-site-csp.d.ts +36 -0
- package/src/lib/plugin-manager/plugin-site-csp.js +50 -1
- package/src/lib/plugin-manager/plugin-site-csp.js.map +1 -1
- package/src/lib/plugin-manager/realm-host-aglyn.generated.js +61 -59
- package/src/lib/plugin-manager/realm-host-aglyn.generated.js.map +1 -1
- package/src/lib/plugin-manager/site-page-enricher-services.d.ts +35 -0
- package/src/lib/plugin-manager/site-page-enricher-services.js +35 -0
- package/src/lib/plugin-manager/site-page-enricher-services.js.map +1 -0
- package/src/lib/plugin-manager/site-page-hooks.js +16 -3
- package/src/lib/plugin-manager/site-page-hooks.js.map +1 -1
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* DECLARED CONNECTIONS: THE MANIFEST'S `connections` BLOCK (AGL-4193).
|
|
19
|
+
*
|
|
20
|
+
* A marketplace plugin's code runs in a sandbox, never on the platform's
|
|
21
|
+
* servers, so it cannot hold an OAuth grant, refresh it, or call a provider's
|
|
22
|
+
* API on a schedule. A connection is the plugin DECLARING all of that as data
|
|
23
|
+
* instead: which provider to send the site owner to, which hosts the platform
|
|
24
|
+
* may call with the grant, how the owner picks what to connect (an account,
|
|
25
|
+
* then one of its locations), and how a scheduled fetch maps the provider's
|
|
26
|
+
* answer into a small, typed, public record the plugin's element then reads.
|
|
27
|
+
* The platform runs the OAuth dance with the publisher's own OAuth app, keeps
|
|
28
|
+
* the tokens sealed, and makes every request itself. Third-party code never
|
|
29
|
+
* sees a token.
|
|
30
|
+
*
|
|
31
|
+
* Everything here is publisher-authored data that the platform turns into
|
|
32
|
+
* outbound requests carrying a customer's token, so it is bounded hard:
|
|
33
|
+
*
|
|
34
|
+
* - every URL is https, with no credentials, query or fragment where none
|
|
35
|
+
* belongs, and never an IP literal or `localhost`;
|
|
36
|
+
* - every request a template describes must land on a host the connection
|
|
37
|
+
* lists in `apiHosts`, checked again after the template is filled in;
|
|
38
|
+
* - a wildcard host covers exactly ONE label (`*.example.com`);
|
|
39
|
+
* - every list, string, page count and record has a ceiling.
|
|
40
|
+
*
|
|
41
|
+
* Pure: no Node, no Firestore, no React. The manifest validator, the bundle
|
|
42
|
+
* checker (and the local CLI built from it), the connect routes and the sync
|
|
43
|
+
* all read this one module, so a declaration cannot pass one and fail another.
|
|
44
|
+
*/
|
|
45
|
+
import type { HostVariable } from './variables';
|
|
46
|
+
/** A request method a template may use. */
|
|
47
|
+
export type PluginConnectionMethod = 'GET' | 'POST';
|
|
48
|
+
/** How the platform authenticates the publisher's OAuth app at the token endpoint. */
|
|
49
|
+
export type PluginConnectionTokenAuthMethod = 'body' | 'basic';
|
|
50
|
+
/** Cursor pagination: the answer names the next page's cursor, a query parameter carries it back. */
|
|
51
|
+
export interface PluginConnectionPagination {
|
|
52
|
+
/** Dot path, in the answer, to the next page's cursor (`nextPageToken`). */
|
|
53
|
+
cursorPath: string;
|
|
54
|
+
/** The query parameter the cursor is sent back in (`pageToken`). */
|
|
55
|
+
cursorParam: string;
|
|
56
|
+
/** Pages fetched at most, 1 to {@link PLUGIN_CONNECTION_MAX_PAGES}. */
|
|
57
|
+
maxPages: number;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* One request the platform makes with a connection's token.
|
|
61
|
+
*
|
|
62
|
+
* `url`, every `query` value and every string `body` value may carry
|
|
63
|
+
* `{{resource.<id>}}`, filled with the id the site owner chose for that
|
|
64
|
+
* resource. Placeholders may appear in the path and the query only, never in
|
|
65
|
+
* the scheme or the host, and the filled-in URL is checked against
|
|
66
|
+
* `apiHosts` again before anything is sent.
|
|
67
|
+
*/
|
|
68
|
+
export interface PluginConnectionRequest {
|
|
69
|
+
method: PluginConnectionMethod;
|
|
70
|
+
url: string;
|
|
71
|
+
query?: Record<string, string>;
|
|
72
|
+
/** A flat JSON body, POST only. */
|
|
73
|
+
body?: Record<string, string | number | boolean>;
|
|
74
|
+
/** Dot path to the array of items in the answer. */
|
|
75
|
+
itemsPath?: string;
|
|
76
|
+
pagination?: PluginConnectionPagination;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Something the site owner picks after connecting: an account, a location.
|
|
80
|
+
* Resources are ordered, and a later one's request may name an earlier one's
|
|
81
|
+
* choice (`{{resource.accounts}}`), which is how a picker chains.
|
|
82
|
+
*/
|
|
83
|
+
export interface PluginConnectionResource {
|
|
84
|
+
/** Identifier, unique within the connection (`accounts`). */
|
|
85
|
+
id: string;
|
|
86
|
+
/** What one of them is called in the picker (`Account`). */
|
|
87
|
+
label: string;
|
|
88
|
+
/** The list request. `itemsPath` is required. */
|
|
89
|
+
request: PluginConnectionRequest & {
|
|
90
|
+
itemsPath: string;
|
|
91
|
+
};
|
|
92
|
+
/** Dot path, in each item, to its id (`name`). */
|
|
93
|
+
idPath: string;
|
|
94
|
+
/** Dot path, in each item, to what the picker shows (`accountName`). */
|
|
95
|
+
labelPath: string;
|
|
96
|
+
/** Items listed at most, across every page. */
|
|
97
|
+
maxItems: number;
|
|
98
|
+
}
|
|
99
|
+
/** The type a record field is coerced to. */
|
|
100
|
+
export type PluginConnectionFieldType = 'string' | 'number' | 'boolean' | 'datetime' | 'url';
|
|
101
|
+
/** One field of the public record, read from an answer by path. */
|
|
102
|
+
export interface PluginConnectionRecordField {
|
|
103
|
+
type: PluginConnectionFieldType;
|
|
104
|
+
/** Dot path to the value: in the request's answer, or in an item. */
|
|
105
|
+
path: string;
|
|
106
|
+
/** Required for `string` and `url`: the value is cut to this many characters. */
|
|
107
|
+
maxLength?: number;
|
|
108
|
+
/**
|
|
109
|
+
* Values to translate before coercion (`{ "FIVE": 5 }`). A value not in
|
|
110
|
+
* the map is dropped, so a provider adding a value cannot leak it raw.
|
|
111
|
+
*/
|
|
112
|
+
map?: Record<string, string | number | boolean>;
|
|
113
|
+
}
|
|
114
|
+
/** A summary field of the record: which sync request it reads from, and where. */
|
|
115
|
+
export interface PluginConnectionSummaryField extends PluginConnectionRecordField {
|
|
116
|
+
/** The sync request id whose answer holds it. */
|
|
117
|
+
request: string;
|
|
118
|
+
}
|
|
119
|
+
/** The record's list: one entry per item of a sync request's answer. */
|
|
120
|
+
export interface PluginConnectionRecordItems {
|
|
121
|
+
/** The sync request whose `itemsPath` items become entries. */
|
|
122
|
+
request: string;
|
|
123
|
+
/** Entries kept at most. */
|
|
124
|
+
maxItems: number;
|
|
125
|
+
/** Fields of each entry, read relative to the item. */
|
|
126
|
+
fields: Record<string, PluginConnectionRecordField>;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* The PUBLIC record a sync writes for a site: what the plugin's element reads.
|
|
130
|
+
* Public by design, so nothing in it may be secret, and it is typed and
|
|
131
|
+
* bounded so the record can never grow past what was declared.
|
|
132
|
+
*/
|
|
133
|
+
export interface PluginConnectionRecordSchema {
|
|
134
|
+
fields?: Record<string, PluginConnectionSummaryField>;
|
|
135
|
+
items?: PluginConnectionRecordItems;
|
|
136
|
+
}
|
|
137
|
+
/** A sync request: a request with an id the record schema names it by. */
|
|
138
|
+
export interface PluginConnectionSyncRequest extends PluginConnectionRequest {
|
|
139
|
+
id: string;
|
|
140
|
+
}
|
|
141
|
+
/** The scheduled fetch the platform runs for every connected site. */
|
|
142
|
+
export interface PluginConnectionSync {
|
|
143
|
+
/** Hours between runs, at least {@link PLUGIN_CONNECTION_MIN_INTERVAL_HOURS}. */
|
|
144
|
+
intervalHours: number;
|
|
145
|
+
requests: PluginConnectionSyncRequest[];
|
|
146
|
+
record: PluginConnectionRecordSchema;
|
|
147
|
+
}
|
|
148
|
+
/** One declared connection. */
|
|
149
|
+
export interface PluginConnectionDeclaration {
|
|
150
|
+
/** Identifier, unique within the manifest; persisted, never renamed. */
|
|
151
|
+
id: string;
|
|
152
|
+
/** The provider's id (`google`); a label for people and logs, never a code path. */
|
|
153
|
+
provider: string;
|
|
154
|
+
/** What the console calls it (`Google Business Profile`). */
|
|
155
|
+
label: string;
|
|
156
|
+
description?: string;
|
|
157
|
+
authorizationUrl: string;
|
|
158
|
+
tokenUrl: string;
|
|
159
|
+
/** Where a grant is revoked on disconnect, when the provider has one. */
|
|
160
|
+
revocationUrl?: string;
|
|
161
|
+
scopes: string[];
|
|
162
|
+
/** How scopes are joined in the authorization request; a space by default. */
|
|
163
|
+
scopeSeparator?: ' ' | ',';
|
|
164
|
+
/** Extra authorization parameters (`access_type=offline`). Reserved names are refused. */
|
|
165
|
+
authParams?: Record<string, string>;
|
|
166
|
+
/** `body` (client_secret_post, the default) or `basic` (client_secret_basic). */
|
|
167
|
+
tokenAuthMethod?: PluginConnectionTokenAuthMethod;
|
|
168
|
+
/** The hosts the platform may call with this connection's token. */
|
|
169
|
+
apiHosts: string[];
|
|
170
|
+
resources?: PluginConnectionResource[];
|
|
171
|
+
sync?: PluginConnectionSync;
|
|
172
|
+
}
|
|
173
|
+
export declare const PLUGIN_CONNECTION_MAX = 4;
|
|
174
|
+
export declare const PLUGIN_CONNECTION_ID_PATTERN: RegExp;
|
|
175
|
+
export declare const PLUGIN_CONNECTION_MAX_SCOPES = 20;
|
|
176
|
+
export declare const PLUGIN_CONNECTION_MAX_API_HOSTS = 10;
|
|
177
|
+
export declare const PLUGIN_CONNECTION_MAX_AUTH_PARAMS = 10;
|
|
178
|
+
export declare const PLUGIN_CONNECTION_MAX_RESOURCES = 3;
|
|
179
|
+
export declare const PLUGIN_CONNECTION_MAX_RESOURCE_ITEMS = 200;
|
|
180
|
+
export declare const PLUGIN_CONNECTION_MAX_SYNC_REQUESTS = 3;
|
|
181
|
+
export declare const PLUGIN_CONNECTION_MAX_PAGES = 10;
|
|
182
|
+
export declare const PLUGIN_CONNECTION_MIN_INTERVAL_HOURS = 1;
|
|
183
|
+
export declare const PLUGIN_CONNECTION_MAX_INTERVAL_HOURS = 168;
|
|
184
|
+
export declare const PLUGIN_CONNECTION_MAX_RECORD_FIELDS = 20;
|
|
185
|
+
export declare const PLUGIN_CONNECTION_MAX_RECORD_ITEMS = 100;
|
|
186
|
+
export declare const PLUGIN_CONNECTION_MAX_STRING_LENGTH = 5000;
|
|
187
|
+
export declare const PLUGIN_CONNECTION_MAX_URL_LENGTH = 2048;
|
|
188
|
+
export declare const PLUGIN_CONNECTION_MAX_MAP_ENTRIES = 32;
|
|
189
|
+
/** The whole block, serialized: a ceiling on everything the lists above multiply to. */
|
|
190
|
+
export declare const PLUGIN_CONNECTION_MAX_DECLARATION_CHARS = 32000;
|
|
191
|
+
/**
|
|
192
|
+
* `capabilities.imageHosts`, at most (AGL-4195). Each one widens the `img-src`
|
|
193
|
+
* of every site that installs the plugin, so the list is kept short.
|
|
194
|
+
*/
|
|
195
|
+
export declare const PLUGIN_MAX_IMAGE_HOSTS = 5;
|
|
196
|
+
/**
|
|
197
|
+
* Authorization parameters the platform sets itself. A declaration naming one
|
|
198
|
+
* would replace the platform's own client id, redirect, state or scope.
|
|
199
|
+
*/
|
|
200
|
+
export declare const PLUGIN_CONNECTION_RESERVED_AUTH_PARAMS: readonly string[];
|
|
201
|
+
/**
|
|
202
|
+
* A host pattern: an exact public hostname (`api.example.com`), or one whose
|
|
203
|
+
* first label is a lone `*` over at least two more labels (`*.example.com`).
|
|
204
|
+
* Anything wider — `*.com`, `*.*.example.com`, `*api.example.com` — is refused.
|
|
205
|
+
*/
|
|
206
|
+
export declare function isPluginConnectionHostPattern(value: unknown): value is string;
|
|
207
|
+
/** Whether `hostname` is covered by `pattern` (exact, or a one-label wildcard). */
|
|
208
|
+
export declare function pluginConnectionHostMatches(pattern: string, hostname: string): boolean;
|
|
209
|
+
/** Whether a URL may be called with a connection's token: https, on a listed host, no credentials. */
|
|
210
|
+
export declare function isPluginConnectionUrlAllowed(url: string, apiHosts: readonly string[]): boolean;
|
|
211
|
+
/** The host of an endpoint URL already validated, for the bundle checker. */
|
|
212
|
+
export declare function pluginConnectionEndpointHosts(connection: PluginConnectionDeclaration): string[];
|
|
213
|
+
/** Whether `value` is a dot path of plain segments (`reviewer.displayName`, `items.0.id`). */
|
|
214
|
+
export declare function isPluginConnectionPath(value: unknown): value is string;
|
|
215
|
+
/**
|
|
216
|
+
* Reads a dot path out of a parsed JSON answer. Own properties only, so a
|
|
217
|
+
* path can never reach `__proto__` or anything else an object inherits.
|
|
218
|
+
*/
|
|
219
|
+
export declare function readPluginConnectionPath(source: unknown, path: string): unknown;
|
|
220
|
+
/**
|
|
221
|
+
* A choice a site owner made, safe to put in a URL path or query: printable,
|
|
222
|
+
* no `..`, nothing that could end the path or start a query, fragment,
|
|
223
|
+
* credential or percent-escape.
|
|
224
|
+
*/
|
|
225
|
+
export declare function isPluginConnectionChoiceId(value: unknown): value is string;
|
|
226
|
+
/** A filled-in request, ready to send. */
|
|
227
|
+
export interface PluginConnectionPreparedRequest {
|
|
228
|
+
method: PluginConnectionMethod;
|
|
229
|
+
url: string;
|
|
230
|
+
body?: string;
|
|
231
|
+
}
|
|
232
|
+
export type PluginConnectionTemplateResult = {
|
|
233
|
+
ok: true;
|
|
234
|
+
request: PluginConnectionPreparedRequest;
|
|
235
|
+
} | {
|
|
236
|
+
ok: false;
|
|
237
|
+
error: string;
|
|
238
|
+
};
|
|
239
|
+
/**
|
|
240
|
+
* Fills a request template with the site's choices and the page cursor, and
|
|
241
|
+
* refuses a result that would leave `apiHosts`. The ONE way a template becomes
|
|
242
|
+
* a request: the connect routes' resource picker and the scheduled sync both
|
|
243
|
+
* call it, so the host check cannot be skipped by either.
|
|
244
|
+
*/
|
|
245
|
+
export declare function preparePluginConnectionRequest(request: PluginConnectionRequest, options: {
|
|
246
|
+
apiHosts: readonly string[];
|
|
247
|
+
choices: Readonly<Record<string, string>>;
|
|
248
|
+
cursor?: string | null;
|
|
249
|
+
}): PluginConnectionTemplateResult;
|
|
250
|
+
type Verdict<T> = {
|
|
251
|
+
ok: true;
|
|
252
|
+
value: T;
|
|
253
|
+
} | {
|
|
254
|
+
ok: false;
|
|
255
|
+
error: string;
|
|
256
|
+
};
|
|
257
|
+
/** Validates one connection. */
|
|
258
|
+
export declare function validatePluginConnection(raw: unknown, where?: string): Verdict<PluginConnectionDeclaration>;
|
|
259
|
+
/**
|
|
260
|
+
* Validates a manifest's whole `connections` block. Refused whole when any
|
|
261
|
+
* entry is malformed — unlike an element, a connection dropped on the way in
|
|
262
|
+
* is an OAuth flow and a sync that silently do not exist.
|
|
263
|
+
*/
|
|
264
|
+
export declare function validatePluginConnections(raw: unknown): Verdict<PluginConnectionDeclaration[]>;
|
|
265
|
+
/**
|
|
266
|
+
* Validates `capabilities.imageHosts`: the hosts a plugin's element may show
|
|
267
|
+
* images from on a published site. The tenant admits each, as an `https://`
|
|
268
|
+
* source, to the `img-src` of the sites that install the plugin (AGL-4195),
|
|
269
|
+
* so the rule is strict: a bare lowercase public hostname, or `*.` over one
|
|
270
|
+
* label of a domain (never `*.com`), no scheme (so never `data:` or `http:`),
|
|
271
|
+
* no port, no path, at most {@link PLUGIN_MAX_IMAGE_HOSTS}. Same host rule as
|
|
272
|
+
* `apiHosts`.
|
|
273
|
+
*/
|
|
274
|
+
export declare function validatePluginImageHosts(raw: unknown): Verdict<string[]>;
|
|
275
|
+
/** The connection a manifest declares under `connectionId`, re-validated, or `null`. */
|
|
276
|
+
export declare function findPluginConnection(manifest: {
|
|
277
|
+
connections?: unknown;
|
|
278
|
+
} | null | undefined, connectionId: string): PluginConnectionDeclaration | null;
|
|
279
|
+
/**
|
|
280
|
+
* The authorization address the site owner is sent to: the declared
|
|
281
|
+
* endpoint with the platform's own client id, redirect, state and scope, and
|
|
282
|
+
* the declaration's extra parameters, which may not override any of those.
|
|
283
|
+
*/
|
|
284
|
+
export declare function pluginConnectionAuthorizeUrl(connection: PluginConnectionDeclaration, options: {
|
|
285
|
+
clientId: string;
|
|
286
|
+
redirectUri: string;
|
|
287
|
+
state: string;
|
|
288
|
+
}): string;
|
|
289
|
+
/**
|
|
290
|
+
* The `{{var:…}}` id a record's SUMMARY field resolves under on a site:
|
|
291
|
+
* `{listingId}__{connectionId}-{field}`, e.g. `Kq3…__reviews-rating`.
|
|
292
|
+
*
|
|
293
|
+
* Chosen so it can never be a site's own variable and can never be two
|
|
294
|
+
* fields at once:
|
|
295
|
+
*
|
|
296
|
+
* - a site's own variables carry Firestore auto ids (letters and digits),
|
|
297
|
+
* and this id always holds `__` and `-`;
|
|
298
|
+
* - a field name never holds `-` (`[A-Za-z][A-Za-z0-9_]*`), so the field is
|
|
299
|
+
* what follows the LAST `-`; a connection id never holds `_`, so the
|
|
300
|
+
* connection is what follows the last `__` before it, and the listing is
|
|
301
|
+
* the rest. Two different triples therefore never spell the same id.
|
|
302
|
+
*
|
|
303
|
+
* `null` when the id would not fit a token (64 characters): such a field
|
|
304
|
+
* has no variable, rather than one that no token could name.
|
|
305
|
+
*/
|
|
306
|
+
export declare function pluginConnectionVariableId(listingId: string, connectionId: string, field: string): string | null;
|
|
307
|
+
/**
|
|
308
|
+
* The site variables one connection's record gives a site: one per declared
|
|
309
|
+
* SUMMARY field (`sync.record.fields`) holding a value, under
|
|
310
|
+
* {@link pluginConnectionVariableId}. A field the record does not hold, or
|
|
311
|
+
* holds as a value of another type than declared, has no variable, so its
|
|
312
|
+
* token renders empty as any unknown variable does. Items never become
|
|
313
|
+
* variables: a list has no single value to print.
|
|
314
|
+
*
|
|
315
|
+
* Each variable's `name` is its id. Names are what a function's expressions
|
|
316
|
+
* read, and an id with `-` in it is not a name an expression can spell, so
|
|
317
|
+
* these never shadow one of the site's own variables in a function.
|
|
318
|
+
*/
|
|
319
|
+
export declare function pluginConnectionRecordVariables(listingId: string, connection: Pick<PluginConnectionDeclaration, 'id' | 'sync'>, fields: Readonly<Record<string, unknown>> | null | undefined): Record<string, HostVariable>;
|
|
320
|
+
export {};
|