@powerformer/prism-client 0.0.0-stage → 0.5.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 +152 -2
- package/build-info.json +8 -0
- package/dist/chunk-546JYWIC.js +15389 -0
- package/dist/chunk-5F3SG6QX.js +285 -0
- package/dist/chunk-PZLXS7XK.js +31 -0
- package/dist/contracts/access.d.ts +8 -0
- package/dist/contracts/resource-manifest.d.ts +75 -0
- package/dist/contracts/types.d.ts +54 -0
- package/dist/sdk/astro.d.ts +13 -0
- package/dist/sdk/astro.js +80 -0
- package/dist/sdk/client.d.ts +8 -0
- package/dist/sdk/contract.d.ts +21 -0
- package/dist/sdk/contract.js +41 -0
- package/dist/sdk/errors.d.ts +10 -0
- package/dist/sdk/index.d.ts +5 -0
- package/dist/sdk/index.js +9 -0
- package/dist/sdk/runtime.d.ts +5 -0
- package/dist/sdk/runtime.js +12 -0
- package/dist/sdk/types.d.ts +56 -0
- package/package.json +47 -4
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export type Environment = 'dev' | 'prod';
|
|
2
|
+
export interface PrismOptions {
|
|
3
|
+
environment: Environment;
|
|
4
|
+
channel?: string;
|
|
5
|
+
/** Frozen URL address shown by Prism: SemVer for new Versions, saved alias for legacy Versions. */
|
|
6
|
+
version?: string;
|
|
7
|
+
locale?: string;
|
|
8
|
+
timeoutMs?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface ResourceOptions<T = unknown> {
|
|
11
|
+
locale?: string;
|
|
12
|
+
/** Synchronous business validation; receives a copy, never the cached object. */
|
|
13
|
+
parse?: (content: unknown) => T;
|
|
14
|
+
}
|
|
15
|
+
export interface PublicationMeta {
|
|
16
|
+
resourceId: string;
|
|
17
|
+
environment: Environment;
|
|
18
|
+
channel: string;
|
|
19
|
+
publicationId: string;
|
|
20
|
+
generation: number;
|
|
21
|
+
versionId: string;
|
|
22
|
+
versionRevision: number;
|
|
23
|
+
version: string | null;
|
|
24
|
+
schemaId: string;
|
|
25
|
+
schemaVersion: number;
|
|
26
|
+
}
|
|
27
|
+
export interface ResourceResult<T = unknown> {
|
|
28
|
+
data: T;
|
|
29
|
+
meta: PublicationMeta & {
|
|
30
|
+
locale: string;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export interface ResourceBundleResult<T = unknown> {
|
|
34
|
+
contents: Readonly<Record<string, T>>;
|
|
35
|
+
defaultLocale: string;
|
|
36
|
+
meta: PublicationMeta;
|
|
37
|
+
}
|
|
38
|
+
export interface ResourceQuery<T = unknown> extends PromiseLike<ResourceResult<T>> {
|
|
39
|
+
getAll(): Promise<ResourceBundleResult<T>>;
|
|
40
|
+
}
|
|
41
|
+
export interface DevUpdate {
|
|
42
|
+
resourceId: string;
|
|
43
|
+
previous: PublicationMeta | null;
|
|
44
|
+
current: PublicationMeta;
|
|
45
|
+
}
|
|
46
|
+
export interface DevServerOptions {
|
|
47
|
+
resources: readonly string[];
|
|
48
|
+
pollIntervalMs?: number;
|
|
49
|
+
onUpdate?: (update: DevUpdate) => void | Promise<void>;
|
|
50
|
+
onError?: (error: import('./errors.js').PrismError) => void;
|
|
51
|
+
}
|
|
52
|
+
export interface DevServerHandle {
|
|
53
|
+
/** Rejects if the initial resource set is unavailable. Polling may recover later. */
|
|
54
|
+
readonly ready: Promise<void>;
|
|
55
|
+
close(): Promise<void>;
|
|
56
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,49 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerformer/prism-client",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.5.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Read published Prism multilingual content with shared caching and Astro development updates.",
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"README.md",
|
|
10
|
+
"build-info.json"
|
|
11
|
+
],
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/sdk/index.d.ts",
|
|
15
|
+
"import": "./dist/sdk/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./astro": {
|
|
18
|
+
"types": "./dist/sdk/astro.d.ts",
|
|
19
|
+
"import": "./dist/sdk/astro.js"
|
|
20
|
+
},
|
|
21
|
+
"./runtime": {
|
|
22
|
+
"types": "./dist/sdk/runtime.d.ts",
|
|
23
|
+
"import": "./dist/sdk/runtime.js"
|
|
24
|
+
},
|
|
25
|
+
"./contract": {
|
|
26
|
+
"types": "./dist/sdk/contract.d.ts",
|
|
27
|
+
"import": "./dist/sdk/contract.js"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=22"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"astro": "^7.4.2"
|
|
35
|
+
},
|
|
36
|
+
"peerDependenciesMeta": {
|
|
37
|
+
"astro": {
|
|
38
|
+
"optional": true
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "https://code.powerformer.net/core/prism.git"
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"registry": "https://registry.npmjs.org/",
|
|
47
|
+
"access": "public"
|
|
48
|
+
}
|
|
49
|
+
}
|