@jchat/addon-sdk 1.0.0-alpha.29 → 1.0.0-alpha.30
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/CHANGELOG.md +6 -0
- package/dist/contracts.d.mts +2 -2
- package/dist/contracts2.d.mts +12 -1
- package/dist/index2.d.mts +8 -2
- package/dist/src.mjs +2 -1
- package/dist/ui.d.mts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/contracts.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
export { ActiveAddon, ActiveAddonFrontend, AddonArchiveFile, AddonAttachment, AddonChatMessage, AddonCommandDefinition, AddonCommandParameter, AddonDistribution, AddonManifest, AddonPermissionDefinition, AddonRequestUser, AddonRuntimeLog, AddonRuntimeLogFilter, AddonRuntimeLogLevel, AddonRuntimeLogSource, AddonUser, HOST_LOCALES, HostLocale, MOUNT_POINTS, MountPoint };
|
|
1
|
+
import { S as ResilientFetchOptions, _ as AddonUser, a as AddonChatMessage, b as MOUNT_POINTS, c as AddonDistribution, d as AddonRequestUser, f as AddonResilientFetch, g as AddonRuntimeLogSource, h as AddonRuntimeLogLevel, i as AddonAttachment, l as AddonManifest, m as AddonRuntimeLogFilter, n as ActiveAddonFrontend, o as AddonCommandDefinition, p as AddonRuntimeLog, r as AddonArchiveFile, s as AddonCommandParameter, t as ActiveAddon, u as AddonPermissionDefinition, v as HOST_LOCALES, x as MountPoint, y as HostLocale } from "./contracts2.mjs";
|
|
2
|
+
export { ActiveAddon, ActiveAddonFrontend, AddonArchiveFile, AddonAttachment, AddonChatMessage, AddonCommandDefinition, AddonCommandParameter, AddonDistribution, AddonManifest, AddonPermissionDefinition, AddonRequestUser, AddonResilientFetch, AddonRuntimeLog, AddonRuntimeLogFilter, AddonRuntimeLogLevel, AddonRuntimeLogSource, AddonUser, HOST_LOCALES, HostLocale, MOUNT_POINTS, MountPoint, ResilientFetchOptions };
|
package/dist/contracts2.d.mts
CHANGED
|
@@ -168,6 +168,17 @@ interface AddonUser {
|
|
|
168
168
|
/** User's gender identifier */
|
|
169
169
|
gender: string;
|
|
170
170
|
}
|
|
171
|
+
/** Options for resilient HTTP fetch requests issued by addons or host services. */
|
|
172
|
+
interface ResilientFetchOptions extends RequestInit {
|
|
173
|
+
/** Maximum number of retry attempts on transient network or 5xx server errors. Defaults to 2. */
|
|
174
|
+
retries?: number;
|
|
175
|
+
/** Initial exponential retry backoff in milliseconds. Defaults to 150. */
|
|
176
|
+
initialDelayMs?: number;
|
|
177
|
+
/** Request timeout in milliseconds per attempt. Defaults to 10000. */
|
|
178
|
+
timeoutMs?: number;
|
|
179
|
+
}
|
|
180
|
+
/** Resilient fetch function type provided to addon server backends. */
|
|
181
|
+
type AddonResilientFetch = (input: string | URL | Request, init?: ResilientFetchOptions) => Promise<Response>;
|
|
171
182
|
/** Authenticated request user context passed to addon server routes and message pipeline hooks. */
|
|
172
183
|
interface AddonRequestUser {
|
|
173
184
|
id: string;
|
|
@@ -268,4 +279,4 @@ interface AddonArchiveFile {
|
|
|
268
279
|
contents: Buffer;
|
|
269
280
|
}
|
|
270
281
|
//#endregion
|
|
271
|
-
export {
|
|
282
|
+
export { ResilientFetchOptions as S, AddonUser as _, AddonChatMessage as a, MOUNT_POINTS as b, AddonDistribution as c, AddonRequestUser as d, AddonResilientFetch as f, AddonRuntimeLogSource as g, AddonRuntimeLogLevel as h, AddonAttachment as i, AddonManifest as l, AddonRuntimeLogFilter as m, ActiveAddonFrontend as n, AddonCommandDefinition as o, AddonRuntimeLog as p, AddonArchiveFile as r, AddonCommandParameter as s, ActiveAddon as t, AddonPermissionDefinition as u, HOST_LOCALES as v, MountPoint as x, HostLocale as y };
|
package/dist/index2.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as IconPack, n as IconComponent, r as IconName } from "./types.mjs";
|
|
2
|
-
import { _ as
|
|
2
|
+
import { S as ResilientFetchOptions, _ as AddonUser, a as AddonChatMessage, b as MOUNT_POINTS, c as AddonDistribution, d as AddonRequestUser, f as AddonResilientFetch, g as AddonRuntimeLogSource, h as AddonRuntimeLogLevel, i as AddonAttachment, l as AddonManifest, m as AddonRuntimeLogFilter, n as ActiveAddonFrontend, o as AddonCommandDefinition, p as AddonRuntimeLog, r as AddonArchiveFile, s as AddonCommandParameter, t as ActiveAddon, u as AddonPermissionDefinition, v as HOST_LOCALES, x as MountPoint, y as HostLocale } from "./contracts2.mjs";
|
|
3
3
|
import { a as canonicalManifest, c as sortValue, i as assertSafeRelativePath, l as validateAddonManifest, n as COMPATIBILITY_RANGE_PATTERN, o as createCanonicalAddonDigest, r as MAX_ADDON_ARCHIVE_BYTES, s as isCompatibilityRange, t as ADDON_ID_PATTERN } from "./signing2.mjs";
|
|
4
4
|
import { AbilityBuilder, MongoAbility, createMongoAbility, subject } from "@casl/ability";
|
|
5
5
|
import { InfiniteData, MutationFunction, QueryFunction, QueryFunctionContext, QueryKey, UndefinedInitialDataInfiniteOptions, UndefinedInitialDataOptions, UseInfiniteQueryResult, UseMutationOptions, UseMutationResult, UseQueryResult, useQueryClient } from "@tanstack/react-query";
|
|
@@ -534,6 +534,12 @@ export interface AddonServerContext<TDatabase = Record<string, Record<string, un
|
|
|
534
534
|
* @returns True if allowed, false otherwise
|
|
535
535
|
*/
|
|
536
536
|
can: (actor: AddonRequestUser | null | undefined, action: string, subject: string, attributes?: Record<string, unknown>) => boolean;
|
|
537
|
+
/**
|
|
538
|
+
* A resilient HTTP fetch client with built-in exponential backoff, jitter, and timeouts.
|
|
539
|
+
* Automatically retries on transient network disconnects and HTTP 5xx responses without requiring
|
|
540
|
+
* external dependencies in addons.
|
|
541
|
+
*/
|
|
542
|
+
fetch: AddonResilientFetch;
|
|
537
543
|
}
|
|
538
544
|
/**
|
|
539
545
|
* Elysia app instance provided to addon server endpoints with Jchat macro metadata (e.g.
|
|
@@ -822,4 +828,4 @@ export declare function verifyAddonEntitlement(addonId: string, target?: ((expec
|
|
|
822
828
|
verifyEntitlement?: (expectedAddonId?: string) => boolean;
|
|
823
829
|
}): boolean;
|
|
824
830
|
//#endregion
|
|
825
|
-
export { ADDON_ID_PATTERN, AbilityBuilder, type ActiveAddon, type ActiveAddonFrontend, type AddonArchiveFile, type AddonAttachment, type AddonChatMessage, type AddonCommandDefinition, type AddonCommandParameter, type AddonDistribution, type AddonManifest, type AddonPermissionDefinition, type AddonRequestUser, type AddonRuntimeLog, type AddonRuntimeLogFilter, type AddonRuntimeLogLevel, type AddonRuntimeLogSource, type AddonUser, COMPATIBILITY_RANGE_PATTERN, type ColumnType, type Generated, HOST_LOCALES, type IconComponent, type IconName, type IconPack, type InfiniteData, type Insertable, type JSONColumnType, MAX_ADDON_ARCHIVE_BYTES, MOUNT_POINTS, type MongoAbility, type MountPoint, type QueryKey, type Selectable, type Updateable, assertSafeRelativePath, canonicalManifest, createCanonicalAddonDigest, createMongoAbility, isCompatibilityRange, sortValue, subject, useQueryClient, validateAddonManifest };
|
|
831
|
+
export { ADDON_ID_PATTERN, AbilityBuilder, type ActiveAddon, type ActiveAddonFrontend, type AddonArchiveFile, type AddonAttachment, type AddonChatMessage, type AddonCommandDefinition, type AddonCommandParameter, type AddonDistribution, type AddonManifest, type AddonPermissionDefinition, type AddonRequestUser, type AddonResilientFetch, type AddonRuntimeLog, type AddonRuntimeLogFilter, type AddonRuntimeLogLevel, type AddonRuntimeLogSource, type AddonUser, COMPATIBILITY_RANGE_PATTERN, type ColumnType, type Generated, HOST_LOCALES, type IconComponent, type IconName, type IconPack, type InfiniteData, type Insertable, type JSONColumnType, MAX_ADDON_ARCHIVE_BYTES, MOUNT_POINTS, type MongoAbility, type MountPoint, type QueryKey, type ResilientFetchOptions, type Selectable, type Updateable, assertSafeRelativePath, canonicalManifest, createCanonicalAddonDigest, createMongoAbility, isCompatibilityRange, sortValue, subject, useQueryClient, validateAddonManifest };
|
package/dist/src.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import "./i18n.mjs";
|
|
|
2
2
|
import { AbilityBuilder, createMongoAbility, subject } from "@casl/ability";
|
|
3
3
|
import { useInfiniteQuery, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
4
4
|
//#region package.json
|
|
5
|
-
var version = "1.0.0-alpha.
|
|
5
|
+
var version = "1.0.0-alpha.30";
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/permissions.ts
|
|
8
8
|
/**
|
|
@@ -318,6 +318,7 @@ function createMockAddonServerContext(addonId, options = {}) {
|
|
|
318
318
|
return {
|
|
319
319
|
context: {
|
|
320
320
|
t: {},
|
|
321
|
+
fetch: async (input, init) => globalThis.fetch(input, init),
|
|
321
322
|
db: {},
|
|
322
323
|
cache,
|
|
323
324
|
rateLimiter,
|
package/dist/ui.d.mts
CHANGED