@wordrhyme/plugin 0.1.0-alpha.5
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/dist/admin/index.d.ts +19 -0
- package/dist/admin/index.js +42 -0
- package/dist/admin/index.js.map +1 -0
- package/dist/artifact.d.ts +17 -0
- package/dist/artifact.js +96 -0
- package/dist/artifact.js.map +1 -0
- package/dist/chunk-46KUIGB6.js +230 -0
- package/dist/chunk-46KUIGB6.js.map +1 -0
- package/dist/chunk-6GDCFR67.js +218 -0
- package/dist/chunk-6GDCFR67.js.map +1 -0
- package/dist/chunk-DY44Q4CK.js +188 -0
- package/dist/chunk-DY44Q4CK.js.map +1 -0
- package/dist/chunk-MZOLSLJ7.js +65 -0
- package/dist/chunk-MZOLSLJ7.js.map +1 -0
- package/dist/chunk-QNCOGISF.js +694 -0
- package/dist/chunk-QNCOGISF.js.map +1 -0
- package/dist/chunk-UGMYO6AU.js +37 -0
- package/dist/chunk-UGMYO6AU.js.map +1 -0
- package/dist/chunk-YQDKOEUI.js +242 -0
- package/dist/chunk-YQDKOEUI.js.map +1 -0
- package/dist/chunk-ZUBFLOKU.js +153 -0
- package/dist/chunk-ZUBFLOKU.js.map +1 -0
- package/dist/client-WXWbuuvd.d.ts +100 -0
- package/dist/client.d.ts +3 -0
- package/dist/client.js +29 -0
- package/dist/client.js.map +1 -0
- package/dist/dev-utils.d.ts +68 -0
- package/dist/dev-utils.js +21 -0
- package/dist/dev-utils.js.map +1 -0
- package/dist/entity-extensions-B5BbZH-m.d.ts +56 -0
- package/dist/globalization.d.ts +80 -0
- package/dist/globalization.js +43 -0
- package/dist/globalization.js.map +1 -0
- package/dist/index.d.ts +316 -0
- package/dist/index.js +354 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest-CPSCN_Ft.d.ts +1471 -0
- package/dist/react.d.ts +145 -0
- package/dist/react.js +94 -0
- package/dist/react.js.map +1 -0
- package/dist/release-CyapqJ3z.d.ts +230 -0
- package/dist/server.d.ts +114 -0
- package/dist/server.js +194 -0
- package/dist/server.js.map +1 -0
- package/dist/time.d.ts +34 -0
- package/dist/time.js +31 -0
- package/dist/time.js.map +1 -0
- package/dist/trpc.d.ts +43 -0
- package/dist/trpc.js +11 -0
- package/dist/trpc.js.map +1 -0
- package/dist/types-8P7XyoyQ.d.ts +1599 -0
- package/package.json +83 -0
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { P as PluginMediaInfo } from './types-8P7XyoyQ.js';
|
|
3
|
+
import './globalization.js';
|
|
4
|
+
import 'decimal.js';
|
|
5
|
+
import './release-CyapqJ3z.js';
|
|
6
|
+
import 'zod';
|
|
7
|
+
import './time.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* React utilities for plugin admin UIs.
|
|
11
|
+
*
|
|
12
|
+
* At runtime, this module is shared via Module Federation from the admin host.
|
|
13
|
+
* Plugins should configure MF shared with `import: false` for this package.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Called by the Admin Host at startup to inject the host's tRPC React client.
|
|
18
|
+
* Plugin code should NOT call this directly.
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
declare function __setTrpc(trpc: any): void;
|
|
22
|
+
/**
|
|
23
|
+
* Hook for plugin components to access their tRPC namespace with React Query hooks.
|
|
24
|
+
* Must be called within a component rendered inside the Admin Host.
|
|
25
|
+
*
|
|
26
|
+
* @param pluginId - Short plugin ID (e.g., 'storage-s3') or full ID (e.g., 'com.wordrhyme.storage-s3')
|
|
27
|
+
* @returns tRPC proxy with useQuery/useMutation hooks
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* import { usePluginTrpc } from '@wordrhyme/plugin/react';
|
|
32
|
+
*
|
|
33
|
+
* function MyPluginPage() {
|
|
34
|
+
* const api = usePluginTrpc('my-plugin');
|
|
35
|
+
* const { data, isLoading } = api.listItems.useQuery();
|
|
36
|
+
* const createItem = api.createItem.useMutation();
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
declare function usePluginTrpc(pluginId: string): any;
|
|
41
|
+
/**
|
|
42
|
+
* Hook for plugin components to access the Admin Host's root tRPC React client.
|
|
43
|
+
* Useful for shared host capabilities such as currency, media, auth, etc.
|
|
44
|
+
*/
|
|
45
|
+
declare function useHostTrpc(): any;
|
|
46
|
+
interface PluginI18nValue {
|
|
47
|
+
locale: string;
|
|
48
|
+
timezone: string;
|
|
49
|
+
isLoading: boolean;
|
|
50
|
+
t: (key: string, paramsOrDefault?: Record<string, string | number> | string) => string;
|
|
51
|
+
addNamespace: (namespace: string) => void;
|
|
52
|
+
}
|
|
53
|
+
declare const PluginI18nContext: React.Context<PluginI18nValue>;
|
|
54
|
+
declare function usePluginTranslation(pluginId: string, customNamespace?: string): {
|
|
55
|
+
t: (key: string, paramsOrDefault?: Record<string, string | number> | string) => string;
|
|
56
|
+
locale: string;
|
|
57
|
+
timezone: string;
|
|
58
|
+
isLoading: boolean;
|
|
59
|
+
namespace: string;
|
|
60
|
+
};
|
|
61
|
+
interface PluginSlotProps {
|
|
62
|
+
/** Slot name, e.g. 'shop.product.detail.actions' */
|
|
63
|
+
name: string;
|
|
64
|
+
/** React props passed to extensions rendered in this slot */
|
|
65
|
+
props?: Record<string, unknown>;
|
|
66
|
+
/** @deprecated Use props. Kept for legacy plugin slot call sites. */
|
|
67
|
+
context?: Record<string, unknown>;
|
|
68
|
+
/** Layout mode */
|
|
69
|
+
layout?: 'inline' | 'stack' | 'tabs' | 'grid';
|
|
70
|
+
/** Additional CSS class */
|
|
71
|
+
className?: string;
|
|
72
|
+
/** Fallback when no extensions registered */
|
|
73
|
+
fallback?: React.ReactNode;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Called by the Admin Host at startup to inject the PluginSlot component.
|
|
77
|
+
* Plugin code should NOT call this directly.
|
|
78
|
+
* @internal
|
|
79
|
+
*/
|
|
80
|
+
declare function __setPluginSlot(component: React.ComponentType<PluginSlotProps>): void;
|
|
81
|
+
/**
|
|
82
|
+
* Renders all plugin extensions registered for the given slot.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```tsx
|
|
86
|
+
* import { PluginSlot } from '@wordrhyme/plugin/react';
|
|
87
|
+
*
|
|
88
|
+
* function ProductDetailPage({ productId }) {
|
|
89
|
+
* return (
|
|
90
|
+
* <div>
|
|
91
|
+
* <h1>Product Detail</h1>
|
|
92
|
+
* <PluginSlot
|
|
93
|
+
* name="shop.product.detail.actions"
|
|
94
|
+
* layout="inline"
|
|
95
|
+
* props={{ productId }}
|
|
96
|
+
* />
|
|
97
|
+
* </div>
|
|
98
|
+
* );
|
|
99
|
+
* }
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
declare function PluginSlot(props: PluginSlotProps): React.ReactElement | null;
|
|
103
|
+
/**
|
|
104
|
+
* Minimal ability interface for plugin permission checks.
|
|
105
|
+
* Matches CASL MongoAbility.can() signature.
|
|
106
|
+
*/
|
|
107
|
+
interface PluginAbility {
|
|
108
|
+
can(action: string, subject: string): boolean;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* React Context for ability — shared between host and plugins.
|
|
112
|
+
* Host injects via AbilityBridge, plugins consume via usePluginAbility.
|
|
113
|
+
*/
|
|
114
|
+
declare const PluginAbilityContext: React.Context<PluginAbility>;
|
|
115
|
+
/**
|
|
116
|
+
* Hook for plugin components to check permissions.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```tsx
|
|
120
|
+
* import { usePluginAbility } from '@wordrhyme/plugin/react';
|
|
121
|
+
*
|
|
122
|
+
* function MyPluginPage() {
|
|
123
|
+
* const ability = usePluginAbility();
|
|
124
|
+
* const canCreate = ability.can('create', 'PluginResource');
|
|
125
|
+
* const canDelete = ability.can('delete', 'PluginResource');
|
|
126
|
+
* }
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
declare function usePluginAbility(): PluginAbility;
|
|
130
|
+
|
|
131
|
+
interface MediaPickerOptions {
|
|
132
|
+
presentation?: 'dialog' | 'drawer';
|
|
133
|
+
mode?: 'single' | 'multi';
|
|
134
|
+
category?: 'all' | 'image' | 'document' | 'video' | 'audio' | 'archive' | 'other';
|
|
135
|
+
onSelect: (media: PluginMediaInfo[]) => void;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Hook to open the global Media Picker dialog (rendered by Admin Host).
|
|
139
|
+
* Returns an imperative API `openDialog(options)`.
|
|
140
|
+
*/
|
|
141
|
+
declare function useMediaPicker(): {
|
|
142
|
+
openDialog: (options: MediaPickerOptions) => void;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export { type MediaPickerOptions, type PluginAbility, PluginAbilityContext, PluginI18nContext, type PluginI18nValue, PluginSlot, type PluginSlotProps, __setPluginSlot, __setTrpc, useHostTrpc, useMediaPicker, usePluginAbility, usePluginTranslation, usePluginTrpc };
|
package/dist/react.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// src/react.ts
|
|
2
|
+
import React from "react";
|
|
3
|
+
var _trpc = null;
|
|
4
|
+
function __setTrpc(trpc) {
|
|
5
|
+
_trpc = trpc;
|
|
6
|
+
}
|
|
7
|
+
function usePluginTrpc(pluginId) {
|
|
8
|
+
if (!_trpc) {
|
|
9
|
+
throw new Error(
|
|
10
|
+
"[plugin/react] tRPC not initialized. Ensure plugin is loaded within Admin Host context."
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
const normalizedId = pluginId.replace(/^com\.wordrhyme\./, "").replace(/\./g, "-");
|
|
14
|
+
return _trpc.pluginApis[normalizedId];
|
|
15
|
+
}
|
|
16
|
+
function useHostTrpc() {
|
|
17
|
+
if (!_trpc) {
|
|
18
|
+
throw new Error(
|
|
19
|
+
"[plugin/react] tRPC not initialized. Ensure plugin is loaded within Admin Host context."
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
return _trpc;
|
|
23
|
+
}
|
|
24
|
+
var defaultI18n = {
|
|
25
|
+
locale: "en-US",
|
|
26
|
+
timezone: "UTC",
|
|
27
|
+
isLoading: false,
|
|
28
|
+
t: (key, paramsOrDefault) => typeof paramsOrDefault === "string" ? paramsOrDefault : key,
|
|
29
|
+
addNamespace: () => void 0
|
|
30
|
+
};
|
|
31
|
+
var PluginI18nContext = React.createContext(defaultI18n);
|
|
32
|
+
function normalizePluginNamespace(pluginId) {
|
|
33
|
+
return `plugin.${pluginId}`;
|
|
34
|
+
}
|
|
35
|
+
function usePluginTranslation(pluginId, customNamespace) {
|
|
36
|
+
const namespace = customNamespace || normalizePluginNamespace(pluginId);
|
|
37
|
+
const i18n = React.useContext(PluginI18nContext);
|
|
38
|
+
React.useEffect(() => {
|
|
39
|
+
i18n.addNamespace(namespace);
|
|
40
|
+
}, [i18n, namespace]);
|
|
41
|
+
const t = React.useCallback(
|
|
42
|
+
(key, paramsOrDefault) => {
|
|
43
|
+
const fullKey = key.startsWith(`${namespace}.`) ? key : `${namespace}.${key}`;
|
|
44
|
+
return i18n.t(fullKey, paramsOrDefault);
|
|
45
|
+
},
|
|
46
|
+
[i18n, namespace]
|
|
47
|
+
);
|
|
48
|
+
return React.useMemo(
|
|
49
|
+
() => ({ t, locale: i18n.locale, timezone: i18n.timezone, isLoading: i18n.isLoading, namespace }),
|
|
50
|
+
[t, i18n.locale, i18n.timezone, i18n.isLoading, namespace]
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
var _PluginSlotImpl = null;
|
|
54
|
+
function __setPluginSlot(component) {
|
|
55
|
+
_PluginSlotImpl = component;
|
|
56
|
+
}
|
|
57
|
+
function PluginSlot(props) {
|
|
58
|
+
if (!_PluginSlotImpl) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
return React.createElement(_PluginSlotImpl, props);
|
|
62
|
+
}
|
|
63
|
+
var defaultAbility = { can: () => true };
|
|
64
|
+
var PluginAbilityContext = React.createContext(defaultAbility);
|
|
65
|
+
function usePluginAbility() {
|
|
66
|
+
return React.useContext(PluginAbilityContext);
|
|
67
|
+
}
|
|
68
|
+
function useMediaPicker() {
|
|
69
|
+
return {
|
|
70
|
+
openDialog: (options) => {
|
|
71
|
+
if (typeof window !== "undefined") {
|
|
72
|
+
const picker = window.__WORDRHYME_MEDIA_PICKER__ || window.__OMNIDS_MEDIA_PICKER__;
|
|
73
|
+
if (picker) {
|
|
74
|
+
picker.open(options);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
console.warn("[plugin/react] Media Picker is not mounted by the Admin Host.");
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export {
|
|
83
|
+
PluginAbilityContext,
|
|
84
|
+
PluginI18nContext,
|
|
85
|
+
PluginSlot,
|
|
86
|
+
__setPluginSlot,
|
|
87
|
+
__setTrpc,
|
|
88
|
+
useHostTrpc,
|
|
89
|
+
useMediaPicker,
|
|
90
|
+
usePluginAbility,
|
|
91
|
+
usePluginTranslation,
|
|
92
|
+
usePluginTrpc
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=react.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/react.ts"],"sourcesContent":["/**\n * React utilities for plugin admin UIs.\n *\n * At runtime, this module is shared via Module Federation from the admin host.\n * Plugins should configure MF shared with `import: false` for this package.\n */\nimport React from 'react';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet _trpc: any = null;\n\n/**\n * Called by the Admin Host at startup to inject the host's tRPC React client.\n * Plugin code should NOT call this directly.\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function __setTrpc(trpc: any) {\n _trpc = trpc;\n}\n\n/**\n * Hook for plugin components to access their tRPC namespace with React Query hooks.\n * Must be called within a component rendered inside the Admin Host.\n *\n * @param pluginId - Short plugin ID (e.g., 'storage-s3') or full ID (e.g., 'com.wordrhyme.storage-s3')\n * @returns tRPC proxy with useQuery/useMutation hooks\n *\n * @example\n * ```tsx\n * import { usePluginTrpc } from '@wordrhyme/plugin/react';\n *\n * function MyPluginPage() {\n * const api = usePluginTrpc('my-plugin');\n * const { data, isLoading } = api.listItems.useQuery();\n * const createItem = api.createItem.useMutation();\n * }\n * ```\n */\nexport function usePluginTrpc(pluginId: string) {\n if (!_trpc) {\n throw new Error(\n '[plugin/react] tRPC not initialized. ' +\n 'Ensure plugin is loaded within Admin Host context.',\n );\n }\n const normalizedId = pluginId\n .replace(/^com\\.wordrhyme\\./, '')\n .replace(/\\./g, '-');\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (_trpc as any).pluginApis[normalizedId];\n}\n\n/**\n * Hook for plugin components to access the Admin Host's root tRPC React client.\n * Useful for shared host capabilities such as currency, media, auth, etc.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function useHostTrpc(): any {\n if (!_trpc) {\n throw new Error(\n '[plugin/react] tRPC not initialized. ' +\n 'Ensure plugin is loaded within Admin Host context.',\n );\n }\n return _trpc;\n}\n\n// ============================================================\n// I18n — host translation bridge\n// ============================================================\n\nexport interface PluginI18nValue {\n locale: string;\n timezone: string;\n isLoading: boolean;\n t: (key: string, paramsOrDefault?: Record<string, string | number> | string) => string;\n addNamespace: (namespace: string) => void;\n}\n\nconst defaultI18n: PluginI18nValue = {\n locale: 'en-US',\n timezone: 'UTC',\n isLoading: false,\n t: (key, paramsOrDefault) => (typeof paramsOrDefault === 'string' ? paramsOrDefault : key),\n addNamespace: () => undefined,\n};\n\nexport const PluginI18nContext = React.createContext<PluginI18nValue>(defaultI18n);\n\nfunction normalizePluginNamespace(pluginId: string): string {\n return `plugin.${pluginId}`;\n}\n\nexport function usePluginTranslation(pluginId: string, customNamespace?: string) {\n const namespace = customNamespace || normalizePluginNamespace(pluginId);\n const i18n = React.useContext(PluginI18nContext);\n\n React.useEffect(() => {\n i18n.addNamespace(namespace);\n }, [i18n, namespace]);\n\n const t = React.useCallback(\n (key: string, paramsOrDefault?: Record<string, string | number> | string): string => {\n const fullKey = key.startsWith(`${namespace}.`) ? key : `${namespace}.${key}`;\n return i18n.t(fullKey, paramsOrDefault);\n },\n [i18n, namespace],\n );\n\n return React.useMemo(\n () => ({ t, locale: i18n.locale, timezone: i18n.timezone, isLoading: i18n.isLoading, namespace }),\n [t, i18n.locale, i18n.timezone, i18n.isLoading, namespace],\n );\n}\n\n// ============================================================\n// PluginSlot — runtime-injected from Admin Host\n// ============================================================\n\nexport interface PluginSlotProps {\n /** Slot name, e.g. 'shop.product.detail.actions' */\n name: string;\n /** React props passed to extensions rendered in this slot */\n props?: Record<string, unknown>;\n /** @deprecated Use props. Kept for legacy plugin slot call sites. */\n context?: Record<string, unknown>;\n /** Layout mode */\n layout?: 'inline' | 'stack' | 'tabs' | 'grid';\n /** Additional CSS class */\n className?: string;\n /** Fallback when no extensions registered */\n fallback?: React.ReactNode;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet _PluginSlotImpl: React.ComponentType<PluginSlotProps> | null = null;\n\n/**\n * Called by the Admin Host at startup to inject the PluginSlot component.\n * Plugin code should NOT call this directly.\n * @internal\n */\nexport function __setPluginSlot(component: React.ComponentType<PluginSlotProps>) {\n _PluginSlotImpl = component;\n}\n\n/**\n * Renders all plugin extensions registered for the given slot.\n *\n * @example\n * ```tsx\n * import { PluginSlot } from '@wordrhyme/plugin/react';\n *\n * function ProductDetailPage({ productId }) {\n * return (\n * <div>\n * <h1>Product Detail</h1>\n * <PluginSlot\n * name=\"shop.product.detail.actions\"\n * layout=\"inline\"\n * props={{ productId }}\n * />\n * </div>\n * );\n * }\n * ```\n */\nexport function PluginSlot(props: PluginSlotProps): React.ReactElement | null {\n if (!_PluginSlotImpl) {\n // Silently render nothing if host hasn't injected yet\n return null;\n }\n return React.createElement(_PluginSlotImpl, props);\n}\n\n// Ability — runtime-injected from Admin Host (CASL permission)\n// ============================================================\n\n/**\n * Minimal ability interface for plugin permission checks.\n * Matches CASL MongoAbility.can() signature.\n */\nexport interface PluginAbility {\n can(action: string, subject: string): boolean;\n}\n\n/** Default allow-all ability (when host hasn't injected) */\nconst defaultAbility: PluginAbility = { can: () => true };\n\n/**\n * React Context for ability — shared between host and plugins.\n * Host injects via AbilityBridge, plugins consume via usePluginAbility.\n */\nexport const PluginAbilityContext = React.createContext<PluginAbility>(defaultAbility);\n\n/**\n * Hook for plugin components to check permissions.\n *\n * @example\n * ```tsx\n * import { usePluginAbility } from '@wordrhyme/plugin/react';\n *\n * function MyPluginPage() {\n * const ability = usePluginAbility();\n * const canCreate = ability.can('create', 'PluginResource');\n * const canDelete = ability.can('delete', 'PluginResource');\n * }\n * ```\n */\nexport function usePluginAbility(): PluginAbility {\n return React.useContext(PluginAbilityContext);\n}\n\n// ============================================================\n// Media Picker — accesses global imperative API\n// ============================================================\n\nimport type { PluginMediaInfo } from './types';\n\n// Define the options for the global MediaPicker\nexport interface MediaPickerOptions {\n presentation?: 'dialog' | 'drawer'; // Where to open the picker\n mode?: 'single' | 'multi';\n category?: 'all' | 'image' | 'document' | 'video' | 'audio' | 'archive' | 'other';\n onSelect: (media: PluginMediaInfo[]) => void;\n}\n\n/**\n * Hook to open the global Media Picker dialog (rendered by Admin Host).\n * Returns an imperative API `openDialog(options)`.\n */\nexport function useMediaPicker() {\n return {\n openDialog: (options: MediaPickerOptions) => {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (typeof window !== 'undefined') {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const picker = window.__WORDRHYME_MEDIA_PICKER__ || window.__OMNIDS_MEDIA_PICKER__;\n if (picker) {\n picker.open(options);\n return;\n }\n }\n console.warn('[plugin/react] Media Picker is not mounted by the Admin Host.');\n }\n };\n}\n"],"mappings":";AAMA,OAAO,WAAW;AAGlB,IAAI,QAAa;AAQV,SAAS,UAAU,MAAW;AACjC,UAAQ;AACZ;AAoBO,SAAS,cAAc,UAAkB;AAC5C,MAAI,CAAC,OAAO;AACR,UAAM,IAAI;AAAA,MACN;AAAA,IAEJ;AAAA,EACJ;AACA,QAAM,eAAe,SAChB,QAAQ,qBAAqB,EAAE,EAC/B,QAAQ,OAAO,GAAG;AAEvB,SAAQ,MAAc,WAAW,YAAY;AACjD;AAOO,SAAS,cAAmB;AAC/B,MAAI,CAAC,OAAO;AACR,UAAM,IAAI;AAAA,MACN;AAAA,IAEJ;AAAA,EACJ;AACA,SAAO;AACX;AAcA,IAAM,cAA+B;AAAA,EACjC,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,WAAW;AAAA,EACX,GAAG,CAAC,KAAK,oBAAqB,OAAO,oBAAoB,WAAW,kBAAkB;AAAA,EACtF,cAAc,MAAM;AACxB;AAEO,IAAM,oBAAoB,MAAM,cAA+B,WAAW;AAEjF,SAAS,yBAAyB,UAA0B;AACxD,SAAO,UAAU,QAAQ;AAC7B;AAEO,SAAS,qBAAqB,UAAkB,iBAA0B;AAC7E,QAAM,YAAY,mBAAmB,yBAAyB,QAAQ;AACtE,QAAM,OAAO,MAAM,WAAW,iBAAiB;AAE/C,QAAM,UAAU,MAAM;AAClB,SAAK,aAAa,SAAS;AAAA,EAC/B,GAAG,CAAC,MAAM,SAAS,CAAC;AAEpB,QAAM,IAAI,MAAM;AAAA,IACZ,CAAC,KAAa,oBAAuE;AACjF,YAAM,UAAU,IAAI,WAAW,GAAG,SAAS,GAAG,IAAI,MAAM,GAAG,SAAS,IAAI,GAAG;AAC3E,aAAO,KAAK,EAAE,SAAS,eAAe;AAAA,IAC1C;AAAA,IACA,CAAC,MAAM,SAAS;AAAA,EACpB;AAEA,SAAO,MAAM;AAAA,IACT,OAAO,EAAE,GAAG,QAAQ,KAAK,QAAQ,UAAU,KAAK,UAAU,WAAW,KAAK,WAAW,UAAU;AAAA,IAC/F,CAAC,GAAG,KAAK,QAAQ,KAAK,UAAU,KAAK,WAAW,SAAS;AAAA,EAC7D;AACJ;AAsBA,IAAI,kBAA+D;AAO5D,SAAS,gBAAgB,WAAiD;AAC7E,oBAAkB;AACtB;AAuBO,SAAS,WAAW,OAAmD;AAC1E,MAAI,CAAC,iBAAiB;AAElB,WAAO;AAAA,EACX;AACA,SAAO,MAAM,cAAc,iBAAiB,KAAK;AACrD;AAcA,IAAM,iBAAgC,EAAE,KAAK,MAAM,KAAK;AAMjD,IAAM,uBAAuB,MAAM,cAA6B,cAAc;AAgB9E,SAAS,mBAAkC;AAC9C,SAAO,MAAM,WAAW,oBAAoB;AAChD;AAoBO,SAAS,iBAAiB;AAC7B,SAAO;AAAA,IACH,YAAY,CAAC,YAAgC;AAGzC,UAAI,OAAO,WAAW,aAAa;AAG/B,cAAM,SAAS,OAAO,8BAA8B,OAAO;AAC3D,YAAI,QAAQ;AACR,iBAAO,KAAK,OAAO;AACnB;AAAA,QACJ;AAAA,MACJ;AACA,cAAQ,KAAK,+DAA+D;AAAA,IAChF;AAAA,EACJ;AACJ;","names":[]}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const PLUGIN_ARCHIVE_MEDIA_TYPE = "application/vnd.wordrhyme.plugin+zip";
|
|
4
|
+
declare const PLUGIN_RELEASE_SCHEMA_VERSION: 1;
|
|
5
|
+
declare const REGISTRY_CATALOG_SIGNATURE_DOMAIN = "wordrhyme.registry-catalog-page.v1\0";
|
|
6
|
+
declare const pluginArchivePathSchema: z.ZodString;
|
|
7
|
+
declare const pluginReleaseFileSchema: z.ZodObject<{
|
|
8
|
+
path: z.ZodString;
|
|
9
|
+
size: z.ZodNumber;
|
|
10
|
+
sha256: z.ZodString;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
declare const pluginReleaseSchema: z.ZodObject<{
|
|
13
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
14
|
+
pluginId: z.ZodString;
|
|
15
|
+
version: z.ZodString;
|
|
16
|
+
createdAt: z.ZodISODateTime;
|
|
17
|
+
mediaType: z.ZodLiteral<"application/vnd.wordrhyme.plugin+zip">;
|
|
18
|
+
files: z.ZodArray<z.ZodObject<{
|
|
19
|
+
path: z.ZodString;
|
|
20
|
+
size: z.ZodNumber;
|
|
21
|
+
sha256: z.ZodString;
|
|
22
|
+
}, z.core.$strip>>;
|
|
23
|
+
sbom: z.ZodObject<{
|
|
24
|
+
path: z.ZodString;
|
|
25
|
+
format: z.ZodLiteral<"spdx-json">;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
declare const pluginSignatureSchema: z.ZodObject<{
|
|
29
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
30
|
+
pluginId: z.ZodString;
|
|
31
|
+
version: z.ZodString;
|
|
32
|
+
algorithm: z.ZodLiteral<"ed25519">;
|
|
33
|
+
keyId: z.ZodString;
|
|
34
|
+
signedAt: z.ZodISODateTime;
|
|
35
|
+
releaseSha256: z.ZodString;
|
|
36
|
+
signature: z.ZodString;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
declare const registryReleaseEnvelopeSchema: z.ZodObject<{
|
|
39
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
40
|
+
pluginId: z.ZodString;
|
|
41
|
+
version: z.ZodString;
|
|
42
|
+
publisherId: z.ZodString;
|
|
43
|
+
state: z.ZodLiteral<"published">;
|
|
44
|
+
trustLevel: z.ZodEnum<{
|
|
45
|
+
first_party: "first_party";
|
|
46
|
+
third_party: "third_party";
|
|
47
|
+
}>;
|
|
48
|
+
artifactUrl: z.ZodURL;
|
|
49
|
+
artifactSha256: z.ZodString;
|
|
50
|
+
releaseSha256: z.ZodString;
|
|
51
|
+
publishedAt: z.ZodISODateTime;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
declare const registrySignatureSchema: z.ZodObject<{
|
|
54
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
55
|
+
algorithm: z.ZodLiteral<"ed25519">;
|
|
56
|
+
keyId: z.ZodString;
|
|
57
|
+
signedAt: z.ZodISODateTime;
|
|
58
|
+
envelopeSha256: z.ZodString;
|
|
59
|
+
signature: z.ZodString;
|
|
60
|
+
}, z.core.$strip>;
|
|
61
|
+
declare const registryCatalogPageEnvelopeSchema: z.ZodObject<{
|
|
62
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
63
|
+
snapshotId: z.ZodString;
|
|
64
|
+
generatedAt: z.ZodISODateTime;
|
|
65
|
+
cursor: z.ZodNullable<z.ZodString>;
|
|
66
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
67
|
+
releasesSha256: z.ZodString;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
/**
|
|
70
|
+
* The Registry signature contract intentionally uses an explicit field order.
|
|
71
|
+
* Do not replace this with JSON.stringify(input): callers may construct the
|
|
72
|
+
* same envelope with a different property insertion order.
|
|
73
|
+
*/
|
|
74
|
+
declare function canonicalRegistryReleaseEnvelope(input: RegistryReleaseEnvelope): string;
|
|
75
|
+
declare function registryReleaseSignaturePayload(input: RegistryReleaseEnvelope): Uint8Array;
|
|
76
|
+
declare function canonicalRegistryCatalogPageEnvelope(input: RegistryCatalogPageEnvelope): string;
|
|
77
|
+
declare function registryCatalogPageSignaturePayload(input: RegistryCatalogPageEnvelope): Uint8Array;
|
|
78
|
+
declare const pluginRegistryReleaseSchema: z.ZodObject<{
|
|
79
|
+
pluginId: z.ZodString;
|
|
80
|
+
version: z.ZodString;
|
|
81
|
+
publisherId: z.ZodString;
|
|
82
|
+
state: z.ZodEnum<{
|
|
83
|
+
archived: "archived";
|
|
84
|
+
published: "published";
|
|
85
|
+
suspended: "suspended";
|
|
86
|
+
removed: "removed";
|
|
87
|
+
}>;
|
|
88
|
+
trustLevel: z.ZodEnum<{
|
|
89
|
+
first_party: "first_party";
|
|
90
|
+
third_party: "third_party";
|
|
91
|
+
}>;
|
|
92
|
+
manifest: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
93
|
+
release: z.ZodObject<{
|
|
94
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
95
|
+
pluginId: z.ZodString;
|
|
96
|
+
version: z.ZodString;
|
|
97
|
+
createdAt: z.ZodISODateTime;
|
|
98
|
+
mediaType: z.ZodLiteral<"application/vnd.wordrhyme.plugin+zip">;
|
|
99
|
+
files: z.ZodArray<z.ZodObject<{
|
|
100
|
+
path: z.ZodString;
|
|
101
|
+
size: z.ZodNumber;
|
|
102
|
+
sha256: z.ZodString;
|
|
103
|
+
}, z.core.$strip>>;
|
|
104
|
+
sbom: z.ZodObject<{
|
|
105
|
+
path: z.ZodString;
|
|
106
|
+
format: z.ZodLiteral<"spdx-json">;
|
|
107
|
+
}, z.core.$strip>;
|
|
108
|
+
}, z.core.$strip>;
|
|
109
|
+
artifactUrl: z.ZodURL;
|
|
110
|
+
artifactSha256: z.ZodString;
|
|
111
|
+
releaseSha256: z.ZodString;
|
|
112
|
+
publisherSignature: z.ZodNullable<z.ZodObject<{
|
|
113
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
114
|
+
pluginId: z.ZodString;
|
|
115
|
+
version: z.ZodString;
|
|
116
|
+
algorithm: z.ZodLiteral<"ed25519">;
|
|
117
|
+
keyId: z.ZodString;
|
|
118
|
+
signedAt: z.ZodISODateTime;
|
|
119
|
+
releaseSha256: z.ZodString;
|
|
120
|
+
signature: z.ZodString;
|
|
121
|
+
}, z.core.$strip>>;
|
|
122
|
+
signature: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
123
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
124
|
+
pluginId: z.ZodString;
|
|
125
|
+
version: z.ZodString;
|
|
126
|
+
algorithm: z.ZodLiteral<"ed25519">;
|
|
127
|
+
keyId: z.ZodString;
|
|
128
|
+
signedAt: z.ZodISODateTime;
|
|
129
|
+
releaseSha256: z.ZodString;
|
|
130
|
+
signature: z.ZodString;
|
|
131
|
+
}, z.core.$strip>>>;
|
|
132
|
+
registrySignature: z.ZodObject<{
|
|
133
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
134
|
+
algorithm: z.ZodLiteral<"ed25519">;
|
|
135
|
+
keyId: z.ZodString;
|
|
136
|
+
signedAt: z.ZodISODateTime;
|
|
137
|
+
envelopeSha256: z.ZodString;
|
|
138
|
+
signature: z.ZodString;
|
|
139
|
+
}, z.core.$strip>;
|
|
140
|
+
publishedAt: z.ZodISODateTime;
|
|
141
|
+
}, z.core.$strip>;
|
|
142
|
+
declare const pluginRegistryCatalogSchema: z.ZodObject<{
|
|
143
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
144
|
+
snapshotId: z.ZodString;
|
|
145
|
+
generatedAt: z.ZodISODateTime;
|
|
146
|
+
releases: z.ZodArray<z.ZodObject<{
|
|
147
|
+
pluginId: z.ZodString;
|
|
148
|
+
version: z.ZodString;
|
|
149
|
+
publisherId: z.ZodString;
|
|
150
|
+
state: z.ZodEnum<{
|
|
151
|
+
archived: "archived";
|
|
152
|
+
published: "published";
|
|
153
|
+
suspended: "suspended";
|
|
154
|
+
removed: "removed";
|
|
155
|
+
}>;
|
|
156
|
+
trustLevel: z.ZodEnum<{
|
|
157
|
+
first_party: "first_party";
|
|
158
|
+
third_party: "third_party";
|
|
159
|
+
}>;
|
|
160
|
+
manifest: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
161
|
+
release: z.ZodObject<{
|
|
162
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
163
|
+
pluginId: z.ZodString;
|
|
164
|
+
version: z.ZodString;
|
|
165
|
+
createdAt: z.ZodISODateTime;
|
|
166
|
+
mediaType: z.ZodLiteral<"application/vnd.wordrhyme.plugin+zip">;
|
|
167
|
+
files: z.ZodArray<z.ZodObject<{
|
|
168
|
+
path: z.ZodString;
|
|
169
|
+
size: z.ZodNumber;
|
|
170
|
+
sha256: z.ZodString;
|
|
171
|
+
}, z.core.$strip>>;
|
|
172
|
+
sbom: z.ZodObject<{
|
|
173
|
+
path: z.ZodString;
|
|
174
|
+
format: z.ZodLiteral<"spdx-json">;
|
|
175
|
+
}, z.core.$strip>;
|
|
176
|
+
}, z.core.$strip>;
|
|
177
|
+
artifactUrl: z.ZodURL;
|
|
178
|
+
artifactSha256: z.ZodString;
|
|
179
|
+
releaseSha256: z.ZodString;
|
|
180
|
+
publisherSignature: z.ZodNullable<z.ZodObject<{
|
|
181
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
182
|
+
pluginId: z.ZodString;
|
|
183
|
+
version: z.ZodString;
|
|
184
|
+
algorithm: z.ZodLiteral<"ed25519">;
|
|
185
|
+
keyId: z.ZodString;
|
|
186
|
+
signedAt: z.ZodISODateTime;
|
|
187
|
+
releaseSha256: z.ZodString;
|
|
188
|
+
signature: z.ZodString;
|
|
189
|
+
}, z.core.$strip>>;
|
|
190
|
+
signature: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
191
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
192
|
+
pluginId: z.ZodString;
|
|
193
|
+
version: z.ZodString;
|
|
194
|
+
algorithm: z.ZodLiteral<"ed25519">;
|
|
195
|
+
keyId: z.ZodString;
|
|
196
|
+
signedAt: z.ZodISODateTime;
|
|
197
|
+
releaseSha256: z.ZodString;
|
|
198
|
+
signature: z.ZodString;
|
|
199
|
+
}, z.core.$strip>>>;
|
|
200
|
+
registrySignature: z.ZodObject<{
|
|
201
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
202
|
+
algorithm: z.ZodLiteral<"ed25519">;
|
|
203
|
+
keyId: z.ZodString;
|
|
204
|
+
signedAt: z.ZodISODateTime;
|
|
205
|
+
envelopeSha256: z.ZodString;
|
|
206
|
+
signature: z.ZodString;
|
|
207
|
+
}, z.core.$strip>;
|
|
208
|
+
publishedAt: z.ZodISODateTime;
|
|
209
|
+
}, z.core.$strip>>;
|
|
210
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
211
|
+
catalogSignature: z.ZodObject<{
|
|
212
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
213
|
+
algorithm: z.ZodLiteral<"ed25519">;
|
|
214
|
+
keyId: z.ZodString;
|
|
215
|
+
signedAt: z.ZodISODateTime;
|
|
216
|
+
envelopeSha256: z.ZodString;
|
|
217
|
+
signature: z.ZodString;
|
|
218
|
+
}, z.core.$strip>;
|
|
219
|
+
}, z.core.$strip>;
|
|
220
|
+
declare function registryCatalogReleasesPayload(input: PluginRegistryRelease[]): Uint8Array;
|
|
221
|
+
type PluginReleaseFile = z.infer<typeof pluginReleaseFileSchema>;
|
|
222
|
+
type PluginRelease = z.infer<typeof pluginReleaseSchema>;
|
|
223
|
+
type PluginSignature = z.infer<typeof pluginSignatureSchema>;
|
|
224
|
+
type RegistryReleaseEnvelope = z.infer<typeof registryReleaseEnvelopeSchema>;
|
|
225
|
+
type RegistrySignature = z.infer<typeof registrySignatureSchema>;
|
|
226
|
+
type RegistryCatalogPageEnvelope = z.infer<typeof registryCatalogPageEnvelopeSchema>;
|
|
227
|
+
type PluginRegistryRelease = z.infer<typeof pluginRegistryReleaseSchema>;
|
|
228
|
+
type PluginRegistryCatalog = z.infer<typeof pluginRegistryCatalogSchema>;
|
|
229
|
+
|
|
230
|
+
export { type PluginRelease as P, type RegistryReleaseEnvelope as R, type RegistrySignature as a, type RegistryCatalogPageEnvelope as b, PLUGIN_ARCHIVE_MEDIA_TYPE as c, PLUGIN_RELEASE_SCHEMA_VERSION as d, type PluginRegistryCatalog as e, type PluginRegistryRelease as f, type PluginReleaseFile as g, type PluginSignature as h, REGISTRY_CATALOG_SIGNATURE_DOMAIN as i, canonicalRegistryCatalogPageEnvelope as j, canonicalRegistryReleaseEnvelope as k, pluginRegistryCatalogSchema as l, pluginRegistryReleaseSchema as m, pluginReleaseFileSchema as n, pluginReleaseSchema as o, pluginArchivePathSchema as p, pluginSignatureSchema as q, registryCatalogPageEnvelopeSchema as r, registryCatalogPageSignaturePayload as s, registryCatalogReleasesPayload as t, registryReleaseEnvelopeSchema as u, registryReleaseSignaturePayload as v, registrySignatureSchema as w };
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
export { createPluginContext, pluginProcedure, pluginRouter } from './trpc.js';
|
|
2
|
+
import { a as PluginContext } from './types-8P7XyoyQ.js';
|
|
3
|
+
export { H as HookContext, n as HookTransaction } from './types-8P7XyoyQ.js';
|
|
4
|
+
import { DateRangeResolver } from './time.js';
|
|
5
|
+
export { inferRouterInputs, inferRouterOutputs } from '@trpc/server';
|
|
6
|
+
export { E as ENTITY_EXTENSION_VALUES_SAVE_HOOK_ID, a as EXTENSION_PROJECT_SAVE_HOOK_ID, b as EntityExtensionProjectionValue, c as EntityExtensionValueSaveHandler, d as EntityExtensionValueSavePayload, e as EntityExtensionValueSaveResult, f as entityExtensions, r as registerEntityExtensionValueSaver } from './entity-extensions-B5BbZH-m.js';
|
|
7
|
+
import './globalization.js';
|
|
8
|
+
import 'decimal.js';
|
|
9
|
+
import './release-CyapqJ3z.js';
|
|
10
|
+
import 'zod';
|
|
11
|
+
import './manifest-CPSCN_Ft.js';
|
|
12
|
+
|
|
13
|
+
interface PluginRuntimeRequestContext {
|
|
14
|
+
requestId?: string | undefined;
|
|
15
|
+
organizationId?: string | undefined;
|
|
16
|
+
originalOrganizationId?: string | undefined;
|
|
17
|
+
userId?: string | undefined;
|
|
18
|
+
user?: PluginContext['user'];
|
|
19
|
+
userRole?: string | undefined;
|
|
20
|
+
userRoles?: string[] | undefined;
|
|
21
|
+
currentTeamId?: string | undefined;
|
|
22
|
+
locale?: string | undefined;
|
|
23
|
+
currency?: string | undefined;
|
|
24
|
+
timezone?: string | undefined;
|
|
25
|
+
clientTimeZone?: string | undefined;
|
|
26
|
+
resolveDateRange?: DateRangeResolver | undefined;
|
|
27
|
+
actorType?: PluginContext['actorType'] | 'api-token';
|
|
28
|
+
isSystemContext?: boolean | undefined;
|
|
29
|
+
principal?: PluginContext['principal'];
|
|
30
|
+
invoker?: string | undefined;
|
|
31
|
+
apiTokenId?: string | undefined;
|
|
32
|
+
apiTokenScopes?: string[] | undefined;
|
|
33
|
+
}
|
|
34
|
+
interface CreatePluginRuntimeContextInput {
|
|
35
|
+
pluginId: string;
|
|
36
|
+
request?: unknown;
|
|
37
|
+
response?: unknown;
|
|
38
|
+
requestContext?: PluginRuntimeRequestContext | undefined;
|
|
39
|
+
}
|
|
40
|
+
interface PluginRuntimeBridge {
|
|
41
|
+
createRequestContext(input: PluginRuntimeRequestContext): PluginRuntimeRequestContext;
|
|
42
|
+
createContext(input: CreatePluginRuntimeContextInput): Promise<PluginContext>;
|
|
43
|
+
runWithContext<T>(requestContext: PluginRuntimeRequestContext, callback: () => Promise<T> | T): Promise<T>;
|
|
44
|
+
}
|
|
45
|
+
declare function setPluginRuntimeBridge(bridge: PluginRuntimeBridge): void;
|
|
46
|
+
declare function createPluginRuntimeRequestContext(input: PluginRuntimeRequestContext): PluginRuntimeRequestContext;
|
|
47
|
+
declare function createPluginRuntimeContext(input: CreatePluginRuntimeContextInput): Promise<PluginContext>;
|
|
48
|
+
declare function runWithPluginRuntimeContext<T>(requestContext: PluginRuntimeRequestContext, callback: () => Promise<T> | T): Promise<T>;
|
|
49
|
+
|
|
50
|
+
type OAuthSettingScope = {
|
|
51
|
+
global?: boolean;
|
|
52
|
+
};
|
|
53
|
+
type OAuthSettings = Pick<PluginContext, 'settings' | 'organizationId' | 'userId'>;
|
|
54
|
+
type OAuthQueryValue = string | number | boolean | null | undefined | readonly (string | number | boolean | null | undefined)[];
|
|
55
|
+
type OAuthQueryParams = Record<string, OAuthQueryValue>;
|
|
56
|
+
type OAuthStateRecord<TPayload extends Record<string, unknown> = Record<string, unknown>> = TPayload & {
|
|
57
|
+
createdAt: string;
|
|
58
|
+
expiresAt?: string;
|
|
59
|
+
userId?: string;
|
|
60
|
+
organizationId?: string;
|
|
61
|
+
};
|
|
62
|
+
interface CreateOAuthStateOptions<TPayload extends Record<string, unknown>> extends OAuthSettingScope {
|
|
63
|
+
keyPrefix: string;
|
|
64
|
+
payload: TPayload;
|
|
65
|
+
bytes?: number;
|
|
66
|
+
ttlSeconds?: number;
|
|
67
|
+
encrypted?: boolean;
|
|
68
|
+
includeContext?: boolean;
|
|
69
|
+
now?: Date;
|
|
70
|
+
}
|
|
71
|
+
interface ConsumeOAuthStateOptions extends OAuthSettingScope {
|
|
72
|
+
keyPrefix: string;
|
|
73
|
+
state: string;
|
|
74
|
+
deleteOnConsume?: boolean;
|
|
75
|
+
now?: Date;
|
|
76
|
+
}
|
|
77
|
+
interface VerifyQueryHmacSha256Options {
|
|
78
|
+
signatureKey?: string;
|
|
79
|
+
excludeKeys?: string[];
|
|
80
|
+
digest?: 'hex' | 'base64';
|
|
81
|
+
}
|
|
82
|
+
declare function buildOAuthCallbackPath(providerId: string): string;
|
|
83
|
+
declare function buildOAuthCallbackUrl(providerId: string, baseUrl: string): string;
|
|
84
|
+
declare function buildOAuthResultRedirect(path: string, params: Record<string, string | number | boolean | null | undefined>): string;
|
|
85
|
+
declare function buildOAuthStateKey(keyPrefix: string, state: string): string;
|
|
86
|
+
declare function maskOAuthSecret(value: string): string;
|
|
87
|
+
declare function createOAuthState<TPayload extends Record<string, unknown>>(ctx: OAuthSettings, options: CreateOAuthStateOptions<TPayload>): Promise<{
|
|
88
|
+
state: string;
|
|
89
|
+
key: string;
|
|
90
|
+
payload: OAuthStateRecord<TPayload>;
|
|
91
|
+
}>;
|
|
92
|
+
declare function consumeOAuthState<TPayload extends Record<string, unknown> = Record<string, unknown>>(ctx: OAuthSettings, options: ConsumeOAuthStateOptions): Promise<OAuthStateRecord<TPayload>>;
|
|
93
|
+
declare function verifyQueryHmacSha256(params: OAuthQueryParams, secret: string, options?: VerifyQueryHmacSha256Options): boolean;
|
|
94
|
+
|
|
95
|
+
interface PluginPublicServiceRequest {
|
|
96
|
+
method: string;
|
|
97
|
+
path: string;
|
|
98
|
+
query: Record<string, string | string[]>;
|
|
99
|
+
headers: Record<string, string | undefined>;
|
|
100
|
+
body: unknown;
|
|
101
|
+
requestId: string;
|
|
102
|
+
}
|
|
103
|
+
interface PluginPublicServiceResponse {
|
|
104
|
+
status?: number;
|
|
105
|
+
headers?: Record<string, string>;
|
|
106
|
+
body?: unknown;
|
|
107
|
+
}
|
|
108
|
+
interface PluginPublicService {
|
|
109
|
+
name: string;
|
|
110
|
+
handle(request: PluginPublicServiceRequest, context: PluginContext): Promise<PluginPublicServiceResponse>;
|
|
111
|
+
}
|
|
112
|
+
declare function definePublicService(service: PluginPublicService): PluginPublicService;
|
|
113
|
+
|
|
114
|
+
export { type CreatePluginRuntimeContextInput, type OAuthStateRecord, type PluginPublicService, type PluginPublicServiceRequest, type PluginPublicServiceResponse, type PluginRuntimeBridge, type PluginRuntimeRequestContext, buildOAuthCallbackPath, buildOAuthCallbackUrl, buildOAuthResultRedirect, buildOAuthStateKey, consumeOAuthState, createOAuthState, createPluginRuntimeContext, createPluginRuntimeRequestContext, definePublicService, maskOAuthSecret, runWithPluginRuntimeContext, setPluginRuntimeBridge, verifyQueryHmacSha256 };
|