@justflows/sdk 0.0.0-stage → 1.2.0
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/api-urls.d.ts +4 -0
- package/dist/api-urls.d.ts.map +1 -0
- package/dist/api-urls.js +22 -0
- package/dist/api-urls.js.map +1 -0
- package/dist/cache.d.ts +63 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/cache.js +28 -0
- package/dist/cache.js.map +1 -0
- package/dist/capabilities.d.ts +73 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capabilities.js +118 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/compatibility.d.ts +7 -0
- package/dist/compatibility.d.ts.map +1 -0
- package/dist/compatibility.js +7 -0
- package/dist/compatibility.js.map +1 -0
- package/dist/cookies.d.ts +60 -0
- package/dist/cookies.d.ts.map +1 -0
- package/dist/cookies.js +60 -0
- package/dist/cookies.js.map +1 -0
- package/dist/hooks.d.ts +1393 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +102 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/license.d.ts +26 -0
- package/dist/license.d.ts.map +1 -0
- package/dist/license.js +90 -0
- package/dist/license.js.map +1 -0
- package/dist/media-html.d.ts +85 -0
- package/dist/media-html.d.ts.map +1 -0
- package/dist/media-html.js +181 -0
- package/dist/media-html.js.map +1 -0
- package/dist/patterns.d.ts +72 -0
- package/dist/patterns.d.ts.map +1 -0
- package/dist/patterns.js +86 -0
- package/dist/patterns.js.map +1 -0
- package/dist/placeholders.d.ts +64 -0
- package/dist/placeholders.d.ts.map +1 -0
- package/dist/placeholders.js +38 -0
- package/dist/placeholders.js.map +1 -0
- package/dist/plugin.d.ts +2424 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +724 -0
- package/dist/plugin.js.map +1 -0
- package/dist/publisher-namespace.d.ts +49 -0
- package/dist/publisher-namespace.d.ts.map +1 -0
- package/dist/publisher-namespace.js +106 -0
- package/dist/publisher-namespace.js.map +1 -0
- package/dist/registry.d.ts +64 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +132 -0
- package/dist/registry.js.map +1 -0
- package/dist/search.d.ts +25 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/search.js +2 -0
- package/dist/search.js.map +1 -0
- package/dist/spam.d.ts +30 -0
- package/dist/spam.d.ts.map +1 -0
- package/dist/spam.js +3 -0
- package/dist/spam.js.map +1 -0
- package/dist/templates.d.ts +37 -0
- package/dist/templates.d.ts.map +1 -0
- package/dist/templates.js +52 -0
- package/dist/templates.js.map +1 -0
- package/dist/version.d.ts +5 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +6 -0
- package/dist/version.js.map +1 -0
- package/dist/visibility.d.ts +79 -0
- package/dist/visibility.d.ts.map +1 -0
- package/dist/visibility.js +3 -0
- package/dist/visibility.js.map +1 -0
- package/package.json +46 -4
- package/README.md +0 -3
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content visibility rules a plugin can add to the host's visibility policy.
|
|
3
|
+
* See `docs/CONTENT_VISIBILITY.md`. Available from SDK 0.1.8.
|
|
4
|
+
*/
|
|
5
|
+
/** The visitor being evaluated. Holds no email, name, or other personal data. */
|
|
6
|
+
export interface ContentVisibilityViewerInfo {
|
|
7
|
+
authenticated: boolean;
|
|
8
|
+
/** Null for an anonymous visitor, and when an editor simulates a role. */
|
|
9
|
+
userId: string | null;
|
|
10
|
+
roles: readonly string[];
|
|
11
|
+
}
|
|
12
|
+
/** The item being evaluated. Metadata only: never its body or fields. */
|
|
13
|
+
export interface ContentVisibilitySubject {
|
|
14
|
+
id: string;
|
|
15
|
+
type: string;
|
|
16
|
+
slug: string;
|
|
17
|
+
locale: string;
|
|
18
|
+
translationGroupId: string;
|
|
19
|
+
status: string;
|
|
20
|
+
authorId: string | null;
|
|
21
|
+
}
|
|
22
|
+
export type ContentVisibilityParams = Readonly<Record<string, string | number | boolean | readonly string[]>>;
|
|
23
|
+
/** Why the host is asking. A decision must not change with this value. */
|
|
24
|
+
export type ContentVisibilitySurface = "request" | "explain";
|
|
25
|
+
export interface ContentVisibilityRuleInput {
|
|
26
|
+
siteId: string;
|
|
27
|
+
/** Null only for a rule registered with `scope: "viewer"`. */
|
|
28
|
+
content: ContentVisibilitySubject | null;
|
|
29
|
+
viewer: ContentVisibilityViewerInfo;
|
|
30
|
+
/** The values an operator saved on this rule. Validate them: they may predate your plugin's schema. */
|
|
31
|
+
params: ContentVisibilityParams;
|
|
32
|
+
request: {
|
|
33
|
+
surface: ContentVisibilitySurface;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* What an evaluator returns. `reason` is a code matching
|
|
38
|
+
* `^[a-z][a-z0-9_.-]{0,63}$`, shown to editors in the explanation tool. A
|
|
39
|
+
* missing or malformed decision denies.
|
|
40
|
+
*/
|
|
41
|
+
export interface ContentVisibilityRuleDecision {
|
|
42
|
+
effect: "allow" | "deny";
|
|
43
|
+
reason: string;
|
|
44
|
+
}
|
|
45
|
+
export interface ContentVisibilityRuleOption {
|
|
46
|
+
value: string;
|
|
47
|
+
label: string;
|
|
48
|
+
}
|
|
49
|
+
/** One setting the admin shows for this rule. */
|
|
50
|
+
export interface ContentVisibilityRuleField {
|
|
51
|
+
name: string;
|
|
52
|
+
label: string;
|
|
53
|
+
type: "text" | "number" | "boolean" | "select";
|
|
54
|
+
required?: boolean;
|
|
55
|
+
/** Choices for a `select` field, loaded when an editor opens the rule. */
|
|
56
|
+
options?: readonly ContentVisibilityRuleOption[] | (() => Promise<readonly ContentVisibilityRuleOption[]>);
|
|
57
|
+
}
|
|
58
|
+
export interface ContentVisibilityRuleDefinition {
|
|
59
|
+
/** Unique within the plugin. Stored on policies as `<plugin id>:<id>`. */
|
|
60
|
+
id: string;
|
|
61
|
+
label: string;
|
|
62
|
+
description?: string;
|
|
63
|
+
/**
|
|
64
|
+
* `item` (default) evaluates once per content item. `viewer` declares that
|
|
65
|
+
* the answer depends only on the viewer and `params`, so the host evaluates
|
|
66
|
+
* once per request and passes `content: null`. Prefer `viewer` when it is
|
|
67
|
+
* true: listings stay fast and are not capped.
|
|
68
|
+
*/
|
|
69
|
+
scope?: "item" | "viewer";
|
|
70
|
+
fields?: readonly ContentVisibilityRuleField[];
|
|
71
|
+
/** Answer within one second. Throwing, timing out, or a bad decision counts as a failure and denies. */
|
|
72
|
+
evaluate(input: ContentVisibilityRuleInput): ContentVisibilityRuleDecision | Promise<ContentVisibilityRuleDecision>;
|
|
73
|
+
}
|
|
74
|
+
/** `ctx.visibility`. Requires the `content:read` permission. */
|
|
75
|
+
export interface PluginVisibilityApi {
|
|
76
|
+
/** Register a rule type. Removed on deactivate; returns a function that removes it sooner. */
|
|
77
|
+
registerRule(definition: ContentVisibilityRuleDefinition): () => void;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=visibility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visibility.d.ts","sourceRoot":"","sources":["../src/visibility.ts"],"names":[],"mappings":"AAEA;;;GAGG;AAEH,iFAAiF;AACjF,MAAM,WAAW,2BAA2B;IAC1C,aAAa,EAAE,OAAO,CAAC;IACvB,0EAA0E;IAC1E,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1B;AAED,yEAAyE;AACzE,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED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,MAAM,CAAC,EAAE,SAAS,0BAA0B,EAAE,CAAC;IAC/C,wGAAwG;IACxG,QAAQ,CAAC,KAAK,EAAE,0BAA0B,GAAG,6BAA6B,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;CACrH;AAED,gEAAgE;AAChE,MAAM,WAAW,mBAAmB;IAClC,8FAA8F;IAC9F,YAAY,CAAC,UAAU,EAAE,+BAA+B,GAAG,MAAM,IAAI,CAAC;CACvE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visibility.js","sourceRoot":"","sources":["../src/visibility.ts"],"names":[],"mappings":"AAAA,+BAA+B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justflows/sdk",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Justflows SDK — stable public API for plugin and theme developers",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/JustFlows/justflows-ce-development.git",
|
|
9
|
+
"directory": "packages/sdk"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/JustFlows/justflows-ce-development/tree/develop/packages/sdk#readme",
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"registry": "https://registry.npmjs.org/",
|
|
14
|
+
"access": "public",
|
|
15
|
+
"provenance": true
|
|
16
|
+
},
|
|
17
|
+
"type": "module",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"import": "./dist/index.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"main": "./dist/index.js",
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"files": [
|
|
27
|
+
"dist"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tsc -p tsconfig.json",
|
|
31
|
+
"dev": "tsc -p tsconfig.json --watch",
|
|
32
|
+
"test": "vitest run",
|
|
33
|
+
"lint": "eslint src --ext .ts",
|
|
34
|
+
"typecheck": "tsc -p tsconfig.json --noEmit && pnpm typecheck:tests",
|
|
35
|
+
"clean": "rm -rf dist coverage",
|
|
36
|
+
"typecheck:tests": "tsc -p tsconfig.tests.json --noEmit"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"zod": "^4.6.7"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@types/node": "^26.6.5",
|
|
43
|
+
"typescript": "^7.0.2",
|
|
44
|
+
"vitest": "^5.0.5"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {},
|
|
47
|
+
"license": "MIT"
|
|
48
|
+
}
|
package/README.md
DELETED