every-plugin 0.0.6 → 0.1.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/README.md +1 -265
- package/dist/errors.d.ts +4 -4
- package/dist/index.d.ts +2 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -3
- package/dist/plugin.d.ts +74 -34
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +100 -17
- package/dist/runtime/errors.d.ts +38 -34
- package/dist/runtime/errors.d.ts.map +1 -1
- package/dist/runtime/errors.js +2 -0
- package/dist/runtime/index.d.ts +7 -4
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +5 -10
- package/dist/runtime/services/module-federation.service.d.ts +5 -6
- package/dist/runtime/services/module-federation.service.d.ts.map +1 -1
- package/dist/runtime/services/module-federation.service.js +53 -15
- package/dist/runtime/services/plugin.service.d.ts +13 -6
- package/dist/runtime/services/plugin.service.d.ts.map +1 -1
- package/dist/runtime/services/plugin.service.js +237 -94
- package/dist/runtime/services/secrets.service.d.ts.map +1 -1
- package/dist/runtime/services.d.ts +0 -1
- package/dist/runtime/services.d.ts.map +1 -1
- package/dist/runtime/services.js +0 -1
- package/dist/runtime/streaming/index.d.ts +4 -0
- package/dist/runtime/streaming/index.d.ts.map +1 -0
- package/dist/runtime/streaming/index.js +2 -0
- package/dist/runtime/streaming/state-effects.d.ts +28 -0
- package/dist/runtime/streaming/state-effects.d.ts.map +1 -0
- package/dist/runtime/streaming/state-effects.js +30 -0
- package/dist/runtime/streaming/streaming.d.ts +8 -0
- package/dist/runtime/streaming/streaming.d.ts.map +1 -0
- package/dist/runtime/streaming/streaming.js +107 -0
- package/dist/runtime/streaming/types.d.ts +19 -0
- package/dist/runtime/streaming/types.d.ts.map +1 -0
- package/dist/runtime/streaming/types.js +1 -0
- package/dist/runtime/test-utils.d.ts +3 -0
- package/dist/runtime/test-utils.d.ts.map +1 -0
- package/dist/runtime/test-utils.js +7 -0
- package/dist/runtime/types.d.ts +1 -1
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/runtime/validation.d.ts +2 -7
- package/dist/runtime/validation.d.ts.map +1 -1
- package/dist/testing/index.d.ts +25 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +40 -0
- package/dist/testing/mocks/module-federation.service.d.ts +8 -0
- package/dist/testing/mocks/module-federation.service.d.ts.map +1 -0
- package/dist/testing/mocks/module-federation.service.js +35 -0
- package/package.json +27 -6
- package/dist/runtime/runtime.d.ts +0 -58
- package/dist/runtime/runtime.d.ts.map +0 -1
- package/dist/runtime/runtime.js +0 -75
- package/dist/runtime/runtime.test.d.ts +0 -2
- package/dist/runtime/runtime.test.d.ts.map +0 -1
- package/dist/runtime/runtime.test.js +0 -308
- package/dist/runtime/services/plugin-cache.service.d.ts +0 -18
- package/dist/runtime/services/plugin-cache.service.d.ts.map +0 -1
- package/dist/runtime/services/plugin-cache.service.js +0 -55
- package/dist/source.d.ts +0 -198
- package/dist/source.d.ts.map +0 -1
- package/dist/source.js +0 -90
package/dist/source.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { ErrorDetailsSchema } from "./plugin";
|
|
3
|
-
/**
|
|
4
|
-
* Zod schema for the Author interface
|
|
5
|
-
*/
|
|
6
|
-
export const authorSchema = z.object({
|
|
7
|
-
id: z.string().optional(),
|
|
8
|
-
username: z.string().optional(),
|
|
9
|
-
displayName: z.string().optional(),
|
|
10
|
-
url: z.string().optional(),
|
|
11
|
-
});
|
|
12
|
-
/**
|
|
13
|
-
* Zod schema for PluginSourceItem - defines the structure that plugins must return
|
|
14
|
-
*/
|
|
15
|
-
export const pluginSourceItemSchema = z.object({
|
|
16
|
-
externalId: z.string(),
|
|
17
|
-
content: z.string(),
|
|
18
|
-
contentType: z.string().optional(),
|
|
19
|
-
createdAt: z.string().optional(),
|
|
20
|
-
url: z.string().optional(),
|
|
21
|
-
authors: z.array(authorSchema).optional(),
|
|
22
|
-
raw: z.unknown(),
|
|
23
|
-
});
|
|
24
|
-
/**
|
|
25
|
-
* Standard content types supported by the system.
|
|
26
|
-
* Plugins can extend this with custom types.
|
|
27
|
-
*/
|
|
28
|
-
export const ContentType = {
|
|
29
|
-
POST: "post",
|
|
30
|
-
ARTICLE: "article",
|
|
31
|
-
VIDEO: "video",
|
|
32
|
-
PODCAST: "podcast",
|
|
33
|
-
WEBSITE: "website",
|
|
34
|
-
FEED: "feed",
|
|
35
|
-
DATABASE_ENTRY: "database-entry",
|
|
36
|
-
UNKNOWN: "unknown",
|
|
37
|
-
};
|
|
38
|
-
export const AsyncJobProgressSchema = z.object({
|
|
39
|
-
workflowId: z.string(),
|
|
40
|
-
status: z.enum([
|
|
41
|
-
"submitted",
|
|
42
|
-
"pending",
|
|
43
|
-
"processing",
|
|
44
|
-
"done",
|
|
45
|
-
"error",
|
|
46
|
-
"timeout",
|
|
47
|
-
]),
|
|
48
|
-
submittedAt: z.string(), // ISO timestamp
|
|
49
|
-
lastCheckedAt: z.string().optional(), // ISO timestamp
|
|
50
|
-
errorMessage: z.string().optional(),
|
|
51
|
-
});
|
|
52
|
-
export const PlatformStateSchema = z
|
|
53
|
-
.object({
|
|
54
|
-
latestProcessedId: z
|
|
55
|
-
.union([z.string(), z.number(), z.record(z.string(), z.any())])
|
|
56
|
-
.optional(),
|
|
57
|
-
currentAsyncJob: AsyncJobProgressSchema.nullable().optional(),
|
|
58
|
-
})
|
|
59
|
-
.catchall(z.any());
|
|
60
|
-
// Source-specific schema creators
|
|
61
|
-
export const createSourceInputSchema = (searchOptionsSchema, stateSchema) => z.object({
|
|
62
|
-
searchOptions: searchOptionsSchema,
|
|
63
|
-
lastProcessedState: z
|
|
64
|
-
.object({
|
|
65
|
-
data: stateSchema.optional().nullable(),
|
|
66
|
-
})
|
|
67
|
-
.optional()
|
|
68
|
-
.nullable(),
|
|
69
|
-
});
|
|
70
|
-
export const createSourceOutputSchema = (itemData, stateSchema) => {
|
|
71
|
-
const pluginSourceItemSchema = z.object({
|
|
72
|
-
externalId: z.string(),
|
|
73
|
-
content: z.string(),
|
|
74
|
-
contentType: z.string().optional(),
|
|
75
|
-
createdAt: z.string().optional(),
|
|
76
|
-
url: z.string().optional(),
|
|
77
|
-
authors: z.array(authorSchema).optional(),
|
|
78
|
-
raw: itemData,
|
|
79
|
-
});
|
|
80
|
-
return z.object({
|
|
81
|
-
success: z.boolean(),
|
|
82
|
-
data: z
|
|
83
|
-
.object({
|
|
84
|
-
items: z.array(pluginSourceItemSchema),
|
|
85
|
-
nextLastProcessedState: stateSchema.optional().nullable(),
|
|
86
|
-
})
|
|
87
|
-
.optional(),
|
|
88
|
-
errors: z.array(ErrorDetailsSchema).optional(),
|
|
89
|
-
});
|
|
90
|
-
};
|