@calmlens/sdk 0.16.2 → 0.16.3
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 +2 -0
- package/cjs/{CalmLensConnection-5Hj3trGr.js → CalmLensConnection-BNUHp_AQ.js} +2 -2
- package/cjs/{CalmLensUtils-BeIl1N6N.js → CalmLensUtils-o171ownK.js} +1 -1
- package/cjs/{CalmLensVersion-BGpB9t4-.js → CalmLensVersion-DwhgxQK5.js} +1 -1
- package/cjs/{CalmLensWebhooks-CogUYk8-.js → CalmLensWebhooks-BKrq30Yp.js} +2 -2
- package/cjs/app.js +3 -3
- package/cjs/index.js +1 -1
- package/cjs/server.js +4 -4
- package/cjs/testing.js +97 -97
- package/esm/{CalmLensConnection-BAJdoZHy.js → CalmLensConnection-XTqmlwzG.js} +2 -2
- package/esm/{CalmLensUtils-DqniTKJ8.js → CalmLensUtils-DsF8Aa_x.js} +1 -1
- package/esm/{CalmLensVersion-l_khh4nS.js → CalmLensVersion-DcifRKsx.js} +1 -1
- package/esm/{CalmLensWebhooks-BtrKKLvg.js → CalmLensWebhooks-BvGyk5d3.js} +2 -2
- package/esm/app.js +3 -3
- package/esm/index.js +1 -1
- package/esm/server.js +4 -4
- package/esm/testing.js +97 -97
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -830,3 +830,5 @@ lossy compression; cropping, rotation, and severe colour changes are unsupported
|
|
|
830
830
|
The entry also exports `generateTestTextCode` and `detectTestTrigger` for text
|
|
831
831
|
test inputs. Use your project's test input key; another project's key does not
|
|
832
832
|
activate its test signals.
|
|
833
|
+
|
|
834
|
+
Image moderation considers readable text directly. Optional OCR (`processingOptions.features.ocr.enabled: true` on the wire) adds a text moderation pass and stores retained text in the image’s `content.extractedText`. No separate text child is created. Read the image’s combined `moderation.report`; removing its content also removes the extracted text.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_CalmLensVersion = require("./CalmLensVersion-
|
|
2
|
-
const require_CalmLensUtils = require("./CalmLensUtils-
|
|
1
|
+
const require_CalmLensVersion = require("./CalmLensVersion-DwhgxQK5.js");
|
|
2
|
+
const require_CalmLensUtils = require("./CalmLensUtils-o171ownK.js");
|
|
3
3
|
//#region src/client/CalmLensConnection.ts
|
|
4
4
|
const DEFAULT_TIMEOUT_MS = 12e4;
|
|
5
5
|
const DEFAULT_MAX_RETRIES = 2;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_CalmLensVersion = require("./CalmLensVersion-
|
|
1
|
+
const require_CalmLensVersion = require("./CalmLensVersion-DwhgxQK5.js");
|
|
2
2
|
//#region src/contract/SharedConstants-Dn7ZJF5S.js
|
|
3
3
|
const MAX_IMAGE_UPLOAD_BYTES = /* @__PURE__ */ (() => 20971520)();
|
|
4
4
|
const MIN_MULTIPART_IMAGE_UPLOAD_BYTES = /* @__PURE__ */ (() => 10485760)();
|
|
@@ -395,7 +395,7 @@ const invalidConfig = (message) => new CalmLensError(SDK_ERROR_CODES.INVALID_CON
|
|
|
395
395
|
//#endregion
|
|
396
396
|
//#region src/client/CalmLensVersion.ts
|
|
397
397
|
/** This SDK's version, from its package.json. */
|
|
398
|
-
const SDK_VERSION = "0.16.
|
|
398
|
+
const SDK_VERSION = "0.16.3";
|
|
399
399
|
const runtimeName = () => {
|
|
400
400
|
const runtime = globalThis;
|
|
401
401
|
if (isReactNativeRuntime()) return "react-native";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_CalmLensVersion = require("./CalmLensVersion-
|
|
2
|
-
const require_CalmLensUtils = require("./CalmLensUtils-
|
|
1
|
+
const require_CalmLensVersion = require("./CalmLensVersion-DwhgxQK5.js");
|
|
2
|
+
const require_CalmLensUtils = require("./CalmLensUtils-o171ownK.js");
|
|
3
3
|
//#region src/contract/JsonUtils.js
|
|
4
4
|
const stringifyJsonCanonical = (value) => JSON.stringify(value, (_key, nestedValue) => {
|
|
5
5
|
if (!nestedValue || typeof nestedValue !== "object" || Array.isArray(nestedValue)) return nestedValue;
|
package/cjs/app.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_CalmLensVersion = require("./CalmLensVersion-
|
|
2
|
+
const require_CalmLensVersion = require("./CalmLensVersion-DwhgxQK5.js");
|
|
3
3
|
require("./index.js");
|
|
4
|
-
const require_CalmLensUtils = require("./CalmLensUtils-
|
|
5
|
-
const require_CalmLensConnection = require("./CalmLensConnection-
|
|
4
|
+
const require_CalmLensUtils = require("./CalmLensUtils-o171ownK.js");
|
|
5
|
+
const require_CalmLensConnection = require("./CalmLensConnection-BNUHp_AQ.js");
|
|
6
6
|
//#region src/client/CalmLensAppClient.ts
|
|
7
7
|
const inspectSymbol = Symbol.for("nodejs.util.inspect.custom");
|
|
8
8
|
/**
|
package/cjs/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_CalmLensVersion = require("./CalmLensVersion-
|
|
2
|
+
const require_CalmLensVersion = require("./CalmLensVersion-DwhgxQK5.js");
|
|
3
3
|
exports.CALMLENS_ERROR_CODES = require_CalmLensVersion.CALMLENS_ERROR_CODES;
|
|
4
4
|
exports.CalmLensError = require_CalmLensVersion.CalmLensError;
|
|
5
5
|
exports.SDK_VERSION = require_CalmLensVersion.SDK_VERSION;
|
package/cjs/server.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_CalmLensVersion = require("./CalmLensVersion-
|
|
2
|
+
const require_CalmLensVersion = require("./CalmLensVersion-DwhgxQK5.js");
|
|
3
3
|
require("./index.js");
|
|
4
|
-
const require_CalmLensWebhooks = require("./CalmLensWebhooks-
|
|
5
|
-
const require_CalmLensUtils = require("./CalmLensUtils-
|
|
6
|
-
const require_CalmLensConnection = require("./CalmLensConnection-
|
|
4
|
+
const require_CalmLensWebhooks = require("./CalmLensWebhooks-BKrq30Yp.js");
|
|
5
|
+
const require_CalmLensUtils = require("./CalmLensUtils-o171ownK.js");
|
|
6
|
+
const require_CalmLensConnection = require("./CalmLensConnection-BNUHp_AQ.js");
|
|
7
7
|
const getEnsureLensCacheKey = (options) => require_CalmLensWebhooks.stringifyJsonCanonical({
|
|
8
8
|
identifier: options.identifier,
|
|
9
9
|
name: options.name,
|
package/cjs/testing.js
CHANGED
|
@@ -21,12 +21,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
23
23
|
//#endregion
|
|
24
|
-
const require_CalmLensVersion = require("./CalmLensVersion-
|
|
25
|
-
const require_CalmLensWebhooks = require("./CalmLensWebhooks-
|
|
26
|
-
const require_CalmLensUtils = require("./CalmLensUtils-
|
|
24
|
+
const require_CalmLensVersion = require("./CalmLensVersion-DwhgxQK5.js");
|
|
25
|
+
const require_CalmLensWebhooks = require("./CalmLensWebhooks-BKrq30Yp.js");
|
|
26
|
+
const require_CalmLensUtils = require("./CalmLensUtils-o171ownK.js");
|
|
27
27
|
let zod = require("zod");
|
|
28
28
|
zod = __toESM(zod, 1);
|
|
29
|
-
//#region src/contract/Classification-
|
|
29
|
+
//#region src/contract/Classification-I_opp8t0.js
|
|
30
30
|
var __defProp = Object.defineProperty;
|
|
31
31
|
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
32
32
|
var __exportAll = (all, no_symbols) => {
|
|
@@ -38,6 +38,98 @@ var __exportAll = (all, no_symbols) => {
|
|
|
38
38
|
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
39
39
|
return target;
|
|
40
40
|
};
|
|
41
|
+
const MODERATION_CATEGORY_DEFINITIONS = {
|
|
42
|
+
sexual: {
|
|
43
|
+
summary: "Sexual acts, explicit sexual anatomy, sexual services, sexual assault depictions and clearly erotic material.",
|
|
44
|
+
definition: "covers sexual acts, explicit sexual anatomy, sexual services and clearly erotic material. Descriptions of sexual assault can qualify without erotic intent. Fictional, illustrated and generated depictions can also qualify.",
|
|
45
|
+
exclusions: "Ordinary affection, swimwear, fitness, fashion, non-erotic medical diagrams and general sexual-health education do not qualify on their own. A person accepting money or wearing revealing clothing does not establish sexual content without a qualifying act, display or offer.",
|
|
46
|
+
docsHref: "/docs/guides/moderation-categories#sexual-content"
|
|
47
|
+
},
|
|
48
|
+
violence: {
|
|
49
|
+
summary: "Physical attacks, injury, death, threats against others, and planning or encouraging physical violence.",
|
|
50
|
+
definition: "covers physical attacks, bodily injury, death and threats against others. Accidental or medical injuries and natural death also count; an attacker or intent to harm is not required. It also includes planning, requesting, encouraging or praising physical violence. A depicted or described act can qualify in fiction or news reporting even when the author condemns it.",
|
|
51
|
+
exclusions: "Solely intentional self-injury or suicide belongs under self-harm. Property damage alone, figurative language, abstract discussion of violence, injury or death and merely possessing a weapon do not establish violence. Consensual sport or training without injury or abuse is excluded.",
|
|
52
|
+
docsHref: "/docs/guides/moderation-categories#violence"
|
|
53
|
+
},
|
|
54
|
+
"self-harm": {
|
|
55
|
+
summary: "Intentional self-injury, suicide, preparation, methods or encouragement; text also includes current or recurring self-harm thoughts.",
|
|
56
|
+
definition: "covers intentional self-injury, suicide, current self-harm risk, preparation, methods and encouragement. For text, it also includes current or recurring self-harm thoughts and an explicitly expressed desire to die. Asking for support does not cancel a separate disclosure of current risk or behavior.",
|
|
57
|
+
exclusions: "For images, require evidence of a self-directed act, preparation, harmful methods or encouragement. An injury or covered body does not establish that harm was self-inflicted. General sadness, neutral statistics, prevention, recovery and healed scars alone are excluded.",
|
|
58
|
+
docsHref: "/docs/guides/moderation-categories#self-harm"
|
|
59
|
+
},
|
|
60
|
+
harassment: {
|
|
61
|
+
summary: "Targeted personal abuse, humiliation, bullying or serious intimidation; dislike, ordinary criticism and neutral reporting alone are excluded.",
|
|
62
|
+
definition: "covers personal abuse, humiliation, bullying and serious intimidation directed at a person or identifiable group. The target can be named, implied or defined by an activity or affiliation. A protected identity is not required.",
|
|
63
|
+
exclusions: "Expressions of dislike or anger, such as \"I hate you\" or \"i hate u\", disagreement, ordinary criticism of conduct or competence, untargeted profanity and neutral reporting of abuse do not qualify on their own. Dislike can still qualify when accompanied by personal degradation, threats, serious intimidation or sustained bullying.",
|
|
64
|
+
docsHref: "/docs/guides/moderation-categories#harassment-and-bullying"
|
|
65
|
+
},
|
|
66
|
+
hate: {
|
|
67
|
+
summary: "Identity-based abuse, dehumanization, discriminatory exclusion or threats against people because of protected characteristics.",
|
|
68
|
+
definition: "covers attacks on people because of race, ethnicity, nationality, religion, caste, sex, gender identity, sexual orientation or disability. It includes dehumanization, asserted inferiority, discriminatory exclusion, identity-based abuse and threats.",
|
|
69
|
+
exclusions: "Both the protected target and the identity-based attack must be supported. Identity mentions, cultural clothing, religious imagery, criticism of beliefs or an unrelated threat do not establish hate. Neutral reporting, condemnation and opposition to hate are excluded unless a separate attack is expressed or endorsed.",
|
|
70
|
+
docsHref: "/docs/guides/moderation-categories#hate-and-identity-abuse"
|
|
71
|
+
},
|
|
72
|
+
"criminal-activity": {
|
|
73
|
+
summary: "Planning, assistance, instructions, encouragement or facilitation of a concrete criminal or seriously dangerous act, fraud and scams, and illegal drugs or contraband.",
|
|
74
|
+
definition: "covers planning, requests for assistance, instructions, encouragement or facilitation of a concrete criminal or seriously dangerous act. A request can qualify even when no act occurs and a later reply refuses it. Dangerous activity requires a concrete serious risk of physical harm. It also covers fraud, scams and phishing aimed at the reader, illegal drug use, dealing, production or trafficking, and contraband such as stolen goods, counterfeit money or documents and smuggled or illegally traded weapons.",
|
|
75
|
+
exclusions: "Neutral reporting, prevention, lawful safety advice, fiction without criminal assistance, and vague dangerous references do not qualify. Medical, pharmaceutical, clinical, research and educational content does not qualify, including prescriptions, dosages, side effects, controlled medicines used as prescribed, pharmacies, hospitals and drug manufacturing by pharmaceutical companies. Lawful alcohol and tobacco, harm reduction, addiction recovery and drug-policy discussion do not qualify either. Masks, computers, payment cards, detention or ordinary tools do not establish criminal facilitation by themselves. A clear visual demonstration of how to carry out a crime can qualify.",
|
|
76
|
+
docsHref: "/docs/guides/moderation-categories#criminal-and-dangerous-activity"
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const MODERATION_QUALIFIERS = [
|
|
80
|
+
"sexual-nudity",
|
|
81
|
+
"sexual-activity",
|
|
82
|
+
"sexual-explicit-language",
|
|
83
|
+
"sexual-solicitation",
|
|
84
|
+
"sexual-historical",
|
|
85
|
+
"sexual-documentary",
|
|
86
|
+
"sexual-educational",
|
|
87
|
+
"sexual-fictional",
|
|
88
|
+
"sexual-support-prevention",
|
|
89
|
+
"violence-attack",
|
|
90
|
+
"violence-threat",
|
|
91
|
+
"violence-preparation",
|
|
92
|
+
"violence-encouragement",
|
|
93
|
+
"violence-injury",
|
|
94
|
+
"violence-violent-death",
|
|
95
|
+
"violence-natural-death",
|
|
96
|
+
"violence-graphic",
|
|
97
|
+
"violence-historical",
|
|
98
|
+
"violence-documentary",
|
|
99
|
+
"violence-educational",
|
|
100
|
+
"violence-fictional",
|
|
101
|
+
"violence-support-prevention",
|
|
102
|
+
"self-harm-thoughts",
|
|
103
|
+
"self-harm-preparation",
|
|
104
|
+
"self-harm-act",
|
|
105
|
+
"self-harm-methods",
|
|
106
|
+
"self-harm-encouragement",
|
|
107
|
+
"self-harm-documentary",
|
|
108
|
+
"self-harm-educational",
|
|
109
|
+
"self-harm-fictional",
|
|
110
|
+
"self-harm-support-prevention",
|
|
111
|
+
"harassment-abuse",
|
|
112
|
+
"harassment-intimidation",
|
|
113
|
+
"harassment-threat",
|
|
114
|
+
"harassment-sexual",
|
|
115
|
+
"harassment-encouragement",
|
|
116
|
+
"harassment-fictional",
|
|
117
|
+
"hate-abuse",
|
|
118
|
+
"hate-dehumanization",
|
|
119
|
+
"hate-inferiority",
|
|
120
|
+
"hate-exclusion",
|
|
121
|
+
"hate-threat",
|
|
122
|
+
"hate-historical",
|
|
123
|
+
"hate-fictional",
|
|
124
|
+
"criminal-activity-demonstration",
|
|
125
|
+
"criminal-activity-preparation",
|
|
126
|
+
"criminal-activity-request",
|
|
127
|
+
"criminal-activity-instructions",
|
|
128
|
+
"criminal-activity-promotion",
|
|
129
|
+
"criminal-activity-substances",
|
|
130
|
+
"criminal-activity-fraud",
|
|
131
|
+
"criminal-activity-fictional"
|
|
132
|
+
];
|
|
41
133
|
function getEnumValues(entries) {
|
|
42
134
|
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
43
135
|
return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
@@ -7806,98 +7898,6 @@ const metaStore = (meta) => {
|
|
|
7806
7898
|
}
|
|
7807
7899
|
} };
|
|
7808
7900
|
};
|
|
7809
|
-
const MODERATION_CATEGORY_DEFINITIONS = {
|
|
7810
|
-
sexual: {
|
|
7811
|
-
summary: "Sexual acts, explicit sexual anatomy, sexual services, sexual assault depictions and clearly erotic material.",
|
|
7812
|
-
definition: "covers sexual acts, explicit sexual anatomy, sexual services and clearly erotic material. Descriptions of sexual assault can qualify without erotic intent. Fictional, illustrated and generated depictions can also qualify.",
|
|
7813
|
-
exclusions: "Ordinary affection, swimwear, fitness, fashion, non-erotic medical diagrams and general sexual-health education do not qualify on their own. A person accepting money or wearing revealing clothing does not establish sexual content without a qualifying act, display or offer.",
|
|
7814
|
-
docsHref: "/docs/guides/moderation-categories#sexual-content"
|
|
7815
|
-
},
|
|
7816
|
-
violence: {
|
|
7817
|
-
summary: "Physical attacks, injury, death, threats against others, and planning or encouraging physical violence.",
|
|
7818
|
-
definition: "covers physical attacks, bodily injury, death and threats against others. Accidental or medical injuries and natural death also count; an attacker or intent to harm is not required. It also includes planning, requesting, encouraging or praising physical violence. A depicted or described act can qualify in fiction or news reporting even when the author condemns it.",
|
|
7819
|
-
exclusions: "Solely intentional self-injury or suicide belongs under self-harm. Property damage alone, figurative language, abstract discussion of violence, injury or death and merely possessing a weapon do not establish violence. Consensual sport or training without injury or abuse is excluded.",
|
|
7820
|
-
docsHref: "/docs/guides/moderation-categories#violence"
|
|
7821
|
-
},
|
|
7822
|
-
"self-harm": {
|
|
7823
|
-
summary: "Intentional self-injury, suicide, preparation, methods or encouragement; text also includes current or recurring self-harm thoughts.",
|
|
7824
|
-
definition: "covers intentional self-injury, suicide, current self-harm risk, preparation, methods and encouragement. For text, it also includes current or recurring self-harm thoughts and an explicitly expressed desire to die. Asking for support does not cancel a separate disclosure of current risk or behavior.",
|
|
7825
|
-
exclusions: "For images, require evidence of a self-directed act, preparation, harmful methods or encouragement. An injury or covered body does not establish that harm was self-inflicted. General sadness, neutral statistics, prevention, recovery and healed scars alone are excluded.",
|
|
7826
|
-
docsHref: "/docs/guides/moderation-categories#self-harm"
|
|
7827
|
-
},
|
|
7828
|
-
harassment: {
|
|
7829
|
-
summary: "Targeted personal abuse, humiliation, bullying or serious intimidation; dislike, ordinary criticism and neutral reporting alone are excluded.",
|
|
7830
|
-
definition: "covers personal abuse, humiliation, bullying and serious intimidation directed at a person or identifiable group. The target can be named, implied or defined by an activity or affiliation. A protected identity is not required.",
|
|
7831
|
-
exclusions: "Expressions of dislike or anger, such as \"I hate you\" or \"i hate u\", disagreement, ordinary criticism of conduct or competence, untargeted profanity and neutral reporting of abuse do not qualify on their own. Dislike can still qualify when accompanied by personal degradation, threats, serious intimidation or sustained bullying.",
|
|
7832
|
-
docsHref: "/docs/guides/moderation-categories#harassment-and-bullying"
|
|
7833
|
-
},
|
|
7834
|
-
hate: {
|
|
7835
|
-
summary: "Identity-based abuse, dehumanization, discriminatory exclusion or threats against people because of protected characteristics.",
|
|
7836
|
-
definition: "covers attacks on people because of race, ethnicity, nationality, religion, caste, sex, gender identity, sexual orientation or disability. It includes dehumanization, asserted inferiority, discriminatory exclusion, identity-based abuse and threats.",
|
|
7837
|
-
exclusions: "Both the protected target and the identity-based attack must be supported. Identity mentions, cultural clothing, religious imagery, criticism of beliefs or an unrelated threat do not establish hate. Neutral reporting, condemnation and opposition to hate are excluded unless a separate attack is expressed or endorsed.",
|
|
7838
|
-
docsHref: "/docs/guides/moderation-categories#hate-and-identity-abuse"
|
|
7839
|
-
},
|
|
7840
|
-
"criminal-activity": {
|
|
7841
|
-
summary: "Planning, assistance, instructions, encouragement or facilitation of a concrete criminal or seriously dangerous act, fraud and scams, and illegal drugs or contraband.",
|
|
7842
|
-
definition: "covers planning, requests for assistance, instructions, encouragement or facilitation of a concrete criminal or seriously dangerous act. A request can qualify even when no act occurs and a later reply refuses it. Dangerous activity requires a concrete serious risk of physical harm. It also covers fraud, scams and phishing aimed at the reader, illegal drug use, dealing, production or trafficking, and contraband such as stolen goods, counterfeit money or documents and smuggled or illegally traded weapons.",
|
|
7843
|
-
exclusions: "Neutral reporting, prevention, lawful safety advice, fiction without criminal assistance, and vague dangerous references do not qualify. Medical, pharmaceutical, clinical, research and educational content does not qualify, including prescriptions, dosages, side effects, controlled medicines used as prescribed, pharmacies, hospitals and drug manufacturing by pharmaceutical companies. Lawful alcohol and tobacco, harm reduction, addiction recovery and drug-policy discussion do not qualify either. Masks, computers, payment cards, detention or ordinary tools do not establish criminal facilitation by themselves. A clear visual demonstration of how to carry out a crime can qualify.",
|
|
7844
|
-
docsHref: "/docs/guides/moderation-categories#criminal-and-dangerous-activity"
|
|
7845
|
-
}
|
|
7846
|
-
};
|
|
7847
|
-
const MODERATION_QUALIFIERS = [
|
|
7848
|
-
"sexual-nudity",
|
|
7849
|
-
"sexual-activity",
|
|
7850
|
-
"sexual-explicit-language",
|
|
7851
|
-
"sexual-solicitation",
|
|
7852
|
-
"sexual-historical",
|
|
7853
|
-
"sexual-documentary",
|
|
7854
|
-
"sexual-educational",
|
|
7855
|
-
"sexual-fictional",
|
|
7856
|
-
"sexual-support-prevention",
|
|
7857
|
-
"violence-attack",
|
|
7858
|
-
"violence-threat",
|
|
7859
|
-
"violence-preparation",
|
|
7860
|
-
"violence-encouragement",
|
|
7861
|
-
"violence-injury",
|
|
7862
|
-
"violence-violent-death",
|
|
7863
|
-
"violence-natural-death",
|
|
7864
|
-
"violence-graphic",
|
|
7865
|
-
"violence-historical",
|
|
7866
|
-
"violence-documentary",
|
|
7867
|
-
"violence-educational",
|
|
7868
|
-
"violence-fictional",
|
|
7869
|
-
"violence-support-prevention",
|
|
7870
|
-
"self-harm-thoughts",
|
|
7871
|
-
"self-harm-preparation",
|
|
7872
|
-
"self-harm-act",
|
|
7873
|
-
"self-harm-methods",
|
|
7874
|
-
"self-harm-encouragement",
|
|
7875
|
-
"self-harm-documentary",
|
|
7876
|
-
"self-harm-educational",
|
|
7877
|
-
"self-harm-fictional",
|
|
7878
|
-
"self-harm-support-prevention",
|
|
7879
|
-
"harassment-abuse",
|
|
7880
|
-
"harassment-intimidation",
|
|
7881
|
-
"harassment-threat",
|
|
7882
|
-
"harassment-sexual",
|
|
7883
|
-
"harassment-encouragement",
|
|
7884
|
-
"harassment-fictional",
|
|
7885
|
-
"hate-abuse",
|
|
7886
|
-
"hate-dehumanization",
|
|
7887
|
-
"hate-inferiority",
|
|
7888
|
-
"hate-exclusion",
|
|
7889
|
-
"hate-threat",
|
|
7890
|
-
"hate-historical",
|
|
7891
|
-
"hate-fictional",
|
|
7892
|
-
"criminal-activity-demonstration",
|
|
7893
|
-
"criminal-activity-preparation",
|
|
7894
|
-
"criminal-activity-request",
|
|
7895
|
-
"criminal-activity-instructions",
|
|
7896
|
-
"criminal-activity-promotion",
|
|
7897
|
-
"criminal-activity-substances",
|
|
7898
|
-
"criminal-activity-fraud",
|
|
7899
|
-
"criminal-activity-fictional"
|
|
7900
|
-
];
|
|
7901
7901
|
const docPropertyInfo = createMetaType({ id: "docPropertyInfo" });
|
|
7902
7902
|
/**
|
|
7903
7903
|
* Optional analyses a request can turn on with `processingOptions.features.<id>`. The catalog is
|
|
@@ -7910,7 +7910,7 @@ const createFeatureOptionsSchemas = (booleanSchema) => {
|
|
|
7910
7910
|
const enabled = booleanSchema.meta(metaStore([docPropertyInfo({ description: "Whether to run the feature. Every feature is off unless this is true." })]));
|
|
7911
7911
|
return {
|
|
7912
7912
|
ocr: zod.object({ enabled }).strict().meta(metaStore([docPropertyInfo({
|
|
7913
|
-
description: "Extract
|
|
7913
|
+
description: "Extract text onto the image asset and run an additional text moderation pass. Applies to images, including those extracted from multimedia documents and websites.",
|
|
7914
7914
|
namedType: "OcrFeatureOptions"
|
|
7915
7915
|
})])),
|
|
7916
7916
|
personDetection: zod.object({ enabled }).strict().meta(metaStore([docPropertyInfo({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as invalidArgument, o as CalmLensError, s as SDK_ERROR_CODES, u as API_ERROR_CODES } from "./CalmLensVersion-
|
|
2
|
-
import { a as stringifyQuery, b as getRejectedUploadMimeTypeError, d as CalmLensTransport, g as validateAssetPayload, h as getAssetPayloadByteLength, i as randomUuid, m as assetToData, v as MAX_IMAGE_UPLOAD_BYTES, x as isRejectedUploadMimeType, y as MIN_MULTIPART_IMAGE_UPLOAD_BYTES } from "./CalmLensUtils-
|
|
1
|
+
import { c as invalidArgument, o as CalmLensError, s as SDK_ERROR_CODES, u as API_ERROR_CODES } from "./CalmLensVersion-DcifRKsx.js";
|
|
2
|
+
import { a as stringifyQuery, b as getRejectedUploadMimeTypeError, d as CalmLensTransport, g as validateAssetPayload, h as getAssetPayloadByteLength, i as randomUuid, m as assetToData, v as MAX_IMAGE_UPLOAD_BYTES, x as isRejectedUploadMimeType, y as MIN_MULTIPART_IMAGE_UPLOAD_BYTES } from "./CalmLensUtils-DsF8Aa_x.js";
|
|
3
3
|
//#region src/client/CalmLensConnection.ts
|
|
4
4
|
const DEFAULT_TIMEOUT_MS = 12e4;
|
|
5
5
|
const DEFAULT_MAX_RETRIES = 2;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as invalidArgument, l as invalidConfig, n as getUserAgent, o as CalmLensError, r as isBrowserRuntime, s as SDK_ERROR_CODES, u as API_ERROR_CODES } from "./CalmLensVersion-
|
|
1
|
+
import { c as invalidArgument, l as invalidConfig, n as getUserAgent, o as CalmLensError, r as isBrowserRuntime, s as SDK_ERROR_CODES, u as API_ERROR_CODES } from "./CalmLensVersion-DcifRKsx.js";
|
|
2
2
|
//#region src/contract/SharedConstants-Dn7ZJF5S.js
|
|
3
3
|
const MAX_IMAGE_UPLOAD_BYTES = /* @__PURE__ */ (() => 20971520)();
|
|
4
4
|
const MIN_MULTIPART_IMAGE_UPLOAD_BYTES = /* @__PURE__ */ (() => 10485760)();
|
|
@@ -395,7 +395,7 @@ const invalidConfig = (message) => new CalmLensError(SDK_ERROR_CODES.INVALID_CON
|
|
|
395
395
|
//#endregion
|
|
396
396
|
//#region src/client/CalmLensVersion.ts
|
|
397
397
|
/** This SDK's version, from its package.json. */
|
|
398
|
-
const SDK_VERSION = "0.16.
|
|
398
|
+
const SDK_VERSION = "0.16.3";
|
|
399
399
|
const runtimeName = () => {
|
|
400
400
|
const runtime = globalThis;
|
|
401
401
|
if (isReactNativeRuntime()) return "react-native";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as invalidArgument, o as CalmLensError, s as SDK_ERROR_CODES } from "./CalmLensVersion-
|
|
2
|
-
import { n as encodePathSegment } from "./CalmLensUtils-
|
|
1
|
+
import { c as invalidArgument, o as CalmLensError, s as SDK_ERROR_CODES } from "./CalmLensVersion-DcifRKsx.js";
|
|
2
|
+
import { n as encodePathSegment } from "./CalmLensUtils-DsF8Aa_x.js";
|
|
3
3
|
//#region src/contract/JsonUtils.js
|
|
4
4
|
const stringifyJsonCanonical = (value) => JSON.stringify(value, (_key, nestedValue) => {
|
|
5
5
|
if (!nestedValue || typeof nestedValue !== "object" || Array.isArray(nestedValue)) return nestedValue;
|
package/esm/app.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as CALMLENS_ERROR_CODES, c as invalidArgument, l as invalidConfig, o as CalmLensError, t as SDK_VERSION } from "./CalmLensVersion-
|
|
1
|
+
import { a as CALMLENS_ERROR_CODES, c as invalidArgument, l as invalidConfig, o as CalmLensError, t as SDK_VERSION } from "./CalmLensVersion-DcifRKsx.js";
|
|
2
2
|
import "./index.js";
|
|
3
|
-
import { c as validateAppClientOptions, n as encodePathSegment } from "./CalmLensUtils-
|
|
4
|
-
import { o as prepareSubmitAssetOptions, r as expectUploadedAsset, s as resolveConnectionOptions, t as CalmLensConnection } from "./CalmLensConnection-
|
|
3
|
+
import { c as validateAppClientOptions, n as encodePathSegment } from "./CalmLensUtils-DsF8Aa_x.js";
|
|
4
|
+
import { o as prepareSubmitAssetOptions, r as expectUploadedAsset, s as resolveConnectionOptions, t as CalmLensConnection } from "./CalmLensConnection-XTqmlwzG.js";
|
|
5
5
|
//#region src/client/CalmLensAppClient.ts
|
|
6
6
|
const inspectSymbol = Symbol.for("nodejs.util.inspect.custom");
|
|
7
7
|
/**
|
package/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { a as CALMLENS_ERROR_CODES, o as CalmLensError, t as SDK_VERSION } from "./CalmLensVersion-
|
|
1
|
+
export { a as CALMLENS_ERROR_CODES, o as CalmLensError, t as SDK_VERSION } from "./CalmLensVersion-DcifRKsx.js";
|
package/esm/server.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as CALMLENS_ERROR_CODES, c as invalidArgument, i as isReactNativeRuntime, l as invalidConfig, o as CalmLensError, r as isBrowserRuntime, s as SDK_ERROR_CODES, t as SDK_VERSION } from "./CalmLensVersion-
|
|
1
|
+
import { a as CALMLENS_ERROR_CODES, c as invalidArgument, i as isReactNativeRuntime, l as invalidConfig, o as CalmLensError, r as isBrowserRuntime, s as SDK_ERROR_CODES, t as SDK_VERSION } from "./CalmLensVersion-DcifRKsx.js";
|
|
2
2
|
import "./index.js";
|
|
3
|
-
import { a as parseWebhookEvent, i as WEBHOOK_TIMESTAMP_HEADER, l as stringifyJsonCanonical, n as WEBHOOK_SIGNATURE_HEADER, o as verifyWebhookSignature, r as WEBHOOK_SIGNATURE_TOLERANCE_SECONDS, s as signUploadTokenWithApiKey, t as WEBHOOK_DELIVERY_HEADER } from "./CalmLensWebhooks-
|
|
4
|
-
import { f as sleep, l as validateRequestOptions, n as encodePathSegment, o as toTextAssetOptions, r as pollForDecision, s as transformSelector, t as appendCdnSelector, u as validateServerClientOptions } from "./CalmLensUtils-
|
|
5
|
-
import { a as newIdempotencyKey, i as invalidPayload, n as expectAsset, o as prepareSubmitAssetOptions, s as resolveConnectionOptions, t as CalmLensConnection } from "./CalmLensConnection-
|
|
3
|
+
import { a as parseWebhookEvent, i as WEBHOOK_TIMESTAMP_HEADER, l as stringifyJsonCanonical, n as WEBHOOK_SIGNATURE_HEADER, o as verifyWebhookSignature, r as WEBHOOK_SIGNATURE_TOLERANCE_SECONDS, s as signUploadTokenWithApiKey, t as WEBHOOK_DELIVERY_HEADER } from "./CalmLensWebhooks-BvGyk5d3.js";
|
|
4
|
+
import { f as sleep, l as validateRequestOptions, n as encodePathSegment, o as toTextAssetOptions, r as pollForDecision, s as transformSelector, t as appendCdnSelector, u as validateServerClientOptions } from "./CalmLensUtils-DsF8Aa_x.js";
|
|
5
|
+
import { a as newIdempotencyKey, i as invalidPayload, n as expectAsset, o as prepareSubmitAssetOptions, s as resolveConnectionOptions, t as CalmLensConnection } from "./CalmLensConnection-XTqmlwzG.js";
|
|
6
6
|
const getEnsureLensCacheKey = (options) => stringifyJsonCanonical({
|
|
7
7
|
identifier: options.identifier,
|
|
8
8
|
name: options.name,
|
package/esm/testing.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { c as invalidArgument, d as API_ERROR_DEFINITIONS, o as CalmLensError, s as SDK_ERROR_CODES, u as API_ERROR_CODES } from "./CalmLensVersion-
|
|
2
|
-
import { c as hmacSha256Hex, i as WEBHOOK_TIMESTAMP_HEADER, l as stringifyJsonCanonical, n as WEBHOOK_SIGNATURE_HEADER, s as signUploadTokenWithApiKey, t as WEBHOOK_DELIVERY_HEADER } from "./CalmLensWebhooks-
|
|
3
|
-
import { b as getRejectedUploadMimeTypeError, f as sleep, g as validateAssetPayload, h as getAssetPayloadByteLength, m as assetToData, n as encodePathSegment, o as toTextAssetOptions, p as assetDataToUint8Array, r as pollForDecision, s as transformSelector, t as appendCdnSelector, u as validateServerClientOptions, x as isRejectedUploadMimeType } from "./CalmLensUtils-
|
|
1
|
+
import { c as invalidArgument, d as API_ERROR_DEFINITIONS, o as CalmLensError, s as SDK_ERROR_CODES, u as API_ERROR_CODES } from "./CalmLensVersion-DcifRKsx.js";
|
|
2
|
+
import { c as hmacSha256Hex, i as WEBHOOK_TIMESTAMP_HEADER, l as stringifyJsonCanonical, n as WEBHOOK_SIGNATURE_HEADER, s as signUploadTokenWithApiKey, t as WEBHOOK_DELIVERY_HEADER } from "./CalmLensWebhooks-BvGyk5d3.js";
|
|
3
|
+
import { b as getRejectedUploadMimeTypeError, f as sleep, g as validateAssetPayload, h as getAssetPayloadByteLength, m as assetToData, n as encodePathSegment, o as toTextAssetOptions, p as assetDataToUint8Array, r as pollForDecision, s as transformSelector, t as appendCdnSelector, u as validateServerClientOptions, x as isRejectedUploadMimeType } from "./CalmLensUtils-DsF8Aa_x.js";
|
|
4
4
|
import * as zod from "zod";
|
|
5
|
-
//#region src/contract/Classification-
|
|
5
|
+
//#region src/contract/Classification-I_opp8t0.js
|
|
6
6
|
var __defProp = Object.defineProperty;
|
|
7
7
|
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
8
8
|
var __exportAll = (all, no_symbols) => {
|
|
@@ -14,6 +14,98 @@ var __exportAll = (all, no_symbols) => {
|
|
|
14
14
|
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
15
15
|
return target;
|
|
16
16
|
};
|
|
17
|
+
const MODERATION_CATEGORY_DEFINITIONS = {
|
|
18
|
+
sexual: {
|
|
19
|
+
summary: "Sexual acts, explicit sexual anatomy, sexual services, sexual assault depictions and clearly erotic material.",
|
|
20
|
+
definition: "covers sexual acts, explicit sexual anatomy, sexual services and clearly erotic material. Descriptions of sexual assault can qualify without erotic intent. Fictional, illustrated and generated depictions can also qualify.",
|
|
21
|
+
exclusions: "Ordinary affection, swimwear, fitness, fashion, non-erotic medical diagrams and general sexual-health education do not qualify on their own. A person accepting money or wearing revealing clothing does not establish sexual content without a qualifying act, display or offer.",
|
|
22
|
+
docsHref: "/docs/guides/moderation-categories#sexual-content"
|
|
23
|
+
},
|
|
24
|
+
violence: {
|
|
25
|
+
summary: "Physical attacks, injury, death, threats against others, and planning or encouraging physical violence.",
|
|
26
|
+
definition: "covers physical attacks, bodily injury, death and threats against others. Accidental or medical injuries and natural death also count; an attacker or intent to harm is not required. It also includes planning, requesting, encouraging or praising physical violence. A depicted or described act can qualify in fiction or news reporting even when the author condemns it.",
|
|
27
|
+
exclusions: "Solely intentional self-injury or suicide belongs under self-harm. Property damage alone, figurative language, abstract discussion of violence, injury or death and merely possessing a weapon do not establish violence. Consensual sport or training without injury or abuse is excluded.",
|
|
28
|
+
docsHref: "/docs/guides/moderation-categories#violence"
|
|
29
|
+
},
|
|
30
|
+
"self-harm": {
|
|
31
|
+
summary: "Intentional self-injury, suicide, preparation, methods or encouragement; text also includes current or recurring self-harm thoughts.",
|
|
32
|
+
definition: "covers intentional self-injury, suicide, current self-harm risk, preparation, methods and encouragement. For text, it also includes current or recurring self-harm thoughts and an explicitly expressed desire to die. Asking for support does not cancel a separate disclosure of current risk or behavior.",
|
|
33
|
+
exclusions: "For images, require evidence of a self-directed act, preparation, harmful methods or encouragement. An injury or covered body does not establish that harm was self-inflicted. General sadness, neutral statistics, prevention, recovery and healed scars alone are excluded.",
|
|
34
|
+
docsHref: "/docs/guides/moderation-categories#self-harm"
|
|
35
|
+
},
|
|
36
|
+
harassment: {
|
|
37
|
+
summary: "Targeted personal abuse, humiliation, bullying or serious intimidation; dislike, ordinary criticism and neutral reporting alone are excluded.",
|
|
38
|
+
definition: "covers personal abuse, humiliation, bullying and serious intimidation directed at a person or identifiable group. The target can be named, implied or defined by an activity or affiliation. A protected identity is not required.",
|
|
39
|
+
exclusions: "Expressions of dislike or anger, such as \"I hate you\" or \"i hate u\", disagreement, ordinary criticism of conduct or competence, untargeted profanity and neutral reporting of abuse do not qualify on their own. Dislike can still qualify when accompanied by personal degradation, threats, serious intimidation or sustained bullying.",
|
|
40
|
+
docsHref: "/docs/guides/moderation-categories#harassment-and-bullying"
|
|
41
|
+
},
|
|
42
|
+
hate: {
|
|
43
|
+
summary: "Identity-based abuse, dehumanization, discriminatory exclusion or threats against people because of protected characteristics.",
|
|
44
|
+
definition: "covers attacks on people because of race, ethnicity, nationality, religion, caste, sex, gender identity, sexual orientation or disability. It includes dehumanization, asserted inferiority, discriminatory exclusion, identity-based abuse and threats.",
|
|
45
|
+
exclusions: "Both the protected target and the identity-based attack must be supported. Identity mentions, cultural clothing, religious imagery, criticism of beliefs or an unrelated threat do not establish hate. Neutral reporting, condemnation and opposition to hate are excluded unless a separate attack is expressed or endorsed.",
|
|
46
|
+
docsHref: "/docs/guides/moderation-categories#hate-and-identity-abuse"
|
|
47
|
+
},
|
|
48
|
+
"criminal-activity": {
|
|
49
|
+
summary: "Planning, assistance, instructions, encouragement or facilitation of a concrete criminal or seriously dangerous act, fraud and scams, and illegal drugs or contraband.",
|
|
50
|
+
definition: "covers planning, requests for assistance, instructions, encouragement or facilitation of a concrete criminal or seriously dangerous act. A request can qualify even when no act occurs and a later reply refuses it. Dangerous activity requires a concrete serious risk of physical harm. It also covers fraud, scams and phishing aimed at the reader, illegal drug use, dealing, production or trafficking, and contraband such as stolen goods, counterfeit money or documents and smuggled or illegally traded weapons.",
|
|
51
|
+
exclusions: "Neutral reporting, prevention, lawful safety advice, fiction without criminal assistance, and vague dangerous references do not qualify. Medical, pharmaceutical, clinical, research and educational content does not qualify, including prescriptions, dosages, side effects, controlled medicines used as prescribed, pharmacies, hospitals and drug manufacturing by pharmaceutical companies. Lawful alcohol and tobacco, harm reduction, addiction recovery and drug-policy discussion do not qualify either. Masks, computers, payment cards, detention or ordinary tools do not establish criminal facilitation by themselves. A clear visual demonstration of how to carry out a crime can qualify.",
|
|
52
|
+
docsHref: "/docs/guides/moderation-categories#criminal-and-dangerous-activity"
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const MODERATION_QUALIFIERS = [
|
|
56
|
+
"sexual-nudity",
|
|
57
|
+
"sexual-activity",
|
|
58
|
+
"sexual-explicit-language",
|
|
59
|
+
"sexual-solicitation",
|
|
60
|
+
"sexual-historical",
|
|
61
|
+
"sexual-documentary",
|
|
62
|
+
"sexual-educational",
|
|
63
|
+
"sexual-fictional",
|
|
64
|
+
"sexual-support-prevention",
|
|
65
|
+
"violence-attack",
|
|
66
|
+
"violence-threat",
|
|
67
|
+
"violence-preparation",
|
|
68
|
+
"violence-encouragement",
|
|
69
|
+
"violence-injury",
|
|
70
|
+
"violence-violent-death",
|
|
71
|
+
"violence-natural-death",
|
|
72
|
+
"violence-graphic",
|
|
73
|
+
"violence-historical",
|
|
74
|
+
"violence-documentary",
|
|
75
|
+
"violence-educational",
|
|
76
|
+
"violence-fictional",
|
|
77
|
+
"violence-support-prevention",
|
|
78
|
+
"self-harm-thoughts",
|
|
79
|
+
"self-harm-preparation",
|
|
80
|
+
"self-harm-act",
|
|
81
|
+
"self-harm-methods",
|
|
82
|
+
"self-harm-encouragement",
|
|
83
|
+
"self-harm-documentary",
|
|
84
|
+
"self-harm-educational",
|
|
85
|
+
"self-harm-fictional",
|
|
86
|
+
"self-harm-support-prevention",
|
|
87
|
+
"harassment-abuse",
|
|
88
|
+
"harassment-intimidation",
|
|
89
|
+
"harassment-threat",
|
|
90
|
+
"harassment-sexual",
|
|
91
|
+
"harassment-encouragement",
|
|
92
|
+
"harassment-fictional",
|
|
93
|
+
"hate-abuse",
|
|
94
|
+
"hate-dehumanization",
|
|
95
|
+
"hate-inferiority",
|
|
96
|
+
"hate-exclusion",
|
|
97
|
+
"hate-threat",
|
|
98
|
+
"hate-historical",
|
|
99
|
+
"hate-fictional",
|
|
100
|
+
"criminal-activity-demonstration",
|
|
101
|
+
"criminal-activity-preparation",
|
|
102
|
+
"criminal-activity-request",
|
|
103
|
+
"criminal-activity-instructions",
|
|
104
|
+
"criminal-activity-promotion",
|
|
105
|
+
"criminal-activity-substances",
|
|
106
|
+
"criminal-activity-fraud",
|
|
107
|
+
"criminal-activity-fictional"
|
|
108
|
+
];
|
|
17
109
|
function getEnumValues(entries) {
|
|
18
110
|
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
19
111
|
return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
@@ -7782,98 +7874,6 @@ const metaStore = (meta) => {
|
|
|
7782
7874
|
}
|
|
7783
7875
|
} };
|
|
7784
7876
|
};
|
|
7785
|
-
const MODERATION_CATEGORY_DEFINITIONS = {
|
|
7786
|
-
sexual: {
|
|
7787
|
-
summary: "Sexual acts, explicit sexual anatomy, sexual services, sexual assault depictions and clearly erotic material.",
|
|
7788
|
-
definition: "covers sexual acts, explicit sexual anatomy, sexual services and clearly erotic material. Descriptions of sexual assault can qualify without erotic intent. Fictional, illustrated and generated depictions can also qualify.",
|
|
7789
|
-
exclusions: "Ordinary affection, swimwear, fitness, fashion, non-erotic medical diagrams and general sexual-health education do not qualify on their own. A person accepting money or wearing revealing clothing does not establish sexual content without a qualifying act, display or offer.",
|
|
7790
|
-
docsHref: "/docs/guides/moderation-categories#sexual-content"
|
|
7791
|
-
},
|
|
7792
|
-
violence: {
|
|
7793
|
-
summary: "Physical attacks, injury, death, threats against others, and planning or encouraging physical violence.",
|
|
7794
|
-
definition: "covers physical attacks, bodily injury, death and threats against others. Accidental or medical injuries and natural death also count; an attacker or intent to harm is not required. It also includes planning, requesting, encouraging or praising physical violence. A depicted or described act can qualify in fiction or news reporting even when the author condemns it.",
|
|
7795
|
-
exclusions: "Solely intentional self-injury or suicide belongs under self-harm. Property damage alone, figurative language, abstract discussion of violence, injury or death and merely possessing a weapon do not establish violence. Consensual sport or training without injury or abuse is excluded.",
|
|
7796
|
-
docsHref: "/docs/guides/moderation-categories#violence"
|
|
7797
|
-
},
|
|
7798
|
-
"self-harm": {
|
|
7799
|
-
summary: "Intentional self-injury, suicide, preparation, methods or encouragement; text also includes current or recurring self-harm thoughts.",
|
|
7800
|
-
definition: "covers intentional self-injury, suicide, current self-harm risk, preparation, methods and encouragement. For text, it also includes current or recurring self-harm thoughts and an explicitly expressed desire to die. Asking for support does not cancel a separate disclosure of current risk or behavior.",
|
|
7801
|
-
exclusions: "For images, require evidence of a self-directed act, preparation, harmful methods or encouragement. An injury or covered body does not establish that harm was self-inflicted. General sadness, neutral statistics, prevention, recovery and healed scars alone are excluded.",
|
|
7802
|
-
docsHref: "/docs/guides/moderation-categories#self-harm"
|
|
7803
|
-
},
|
|
7804
|
-
harassment: {
|
|
7805
|
-
summary: "Targeted personal abuse, humiliation, bullying or serious intimidation; dislike, ordinary criticism and neutral reporting alone are excluded.",
|
|
7806
|
-
definition: "covers personal abuse, humiliation, bullying and serious intimidation directed at a person or identifiable group. The target can be named, implied or defined by an activity or affiliation. A protected identity is not required.",
|
|
7807
|
-
exclusions: "Expressions of dislike or anger, such as \"I hate you\" or \"i hate u\", disagreement, ordinary criticism of conduct or competence, untargeted profanity and neutral reporting of abuse do not qualify on their own. Dislike can still qualify when accompanied by personal degradation, threats, serious intimidation or sustained bullying.",
|
|
7808
|
-
docsHref: "/docs/guides/moderation-categories#harassment-and-bullying"
|
|
7809
|
-
},
|
|
7810
|
-
hate: {
|
|
7811
|
-
summary: "Identity-based abuse, dehumanization, discriminatory exclusion or threats against people because of protected characteristics.",
|
|
7812
|
-
definition: "covers attacks on people because of race, ethnicity, nationality, religion, caste, sex, gender identity, sexual orientation or disability. It includes dehumanization, asserted inferiority, discriminatory exclusion, identity-based abuse and threats.",
|
|
7813
|
-
exclusions: "Both the protected target and the identity-based attack must be supported. Identity mentions, cultural clothing, religious imagery, criticism of beliefs or an unrelated threat do not establish hate. Neutral reporting, condemnation and opposition to hate are excluded unless a separate attack is expressed or endorsed.",
|
|
7814
|
-
docsHref: "/docs/guides/moderation-categories#hate-and-identity-abuse"
|
|
7815
|
-
},
|
|
7816
|
-
"criminal-activity": {
|
|
7817
|
-
summary: "Planning, assistance, instructions, encouragement or facilitation of a concrete criminal or seriously dangerous act, fraud and scams, and illegal drugs or contraband.",
|
|
7818
|
-
definition: "covers planning, requests for assistance, instructions, encouragement or facilitation of a concrete criminal or seriously dangerous act. A request can qualify even when no act occurs and a later reply refuses it. Dangerous activity requires a concrete serious risk of physical harm. It also covers fraud, scams and phishing aimed at the reader, illegal drug use, dealing, production or trafficking, and contraband such as stolen goods, counterfeit money or documents and smuggled or illegally traded weapons.",
|
|
7819
|
-
exclusions: "Neutral reporting, prevention, lawful safety advice, fiction without criminal assistance, and vague dangerous references do not qualify. Medical, pharmaceutical, clinical, research and educational content does not qualify, including prescriptions, dosages, side effects, controlled medicines used as prescribed, pharmacies, hospitals and drug manufacturing by pharmaceutical companies. Lawful alcohol and tobacco, harm reduction, addiction recovery and drug-policy discussion do not qualify either. Masks, computers, payment cards, detention or ordinary tools do not establish criminal facilitation by themselves. A clear visual demonstration of how to carry out a crime can qualify.",
|
|
7820
|
-
docsHref: "/docs/guides/moderation-categories#criminal-and-dangerous-activity"
|
|
7821
|
-
}
|
|
7822
|
-
};
|
|
7823
|
-
const MODERATION_QUALIFIERS = [
|
|
7824
|
-
"sexual-nudity",
|
|
7825
|
-
"sexual-activity",
|
|
7826
|
-
"sexual-explicit-language",
|
|
7827
|
-
"sexual-solicitation",
|
|
7828
|
-
"sexual-historical",
|
|
7829
|
-
"sexual-documentary",
|
|
7830
|
-
"sexual-educational",
|
|
7831
|
-
"sexual-fictional",
|
|
7832
|
-
"sexual-support-prevention",
|
|
7833
|
-
"violence-attack",
|
|
7834
|
-
"violence-threat",
|
|
7835
|
-
"violence-preparation",
|
|
7836
|
-
"violence-encouragement",
|
|
7837
|
-
"violence-injury",
|
|
7838
|
-
"violence-violent-death",
|
|
7839
|
-
"violence-natural-death",
|
|
7840
|
-
"violence-graphic",
|
|
7841
|
-
"violence-historical",
|
|
7842
|
-
"violence-documentary",
|
|
7843
|
-
"violence-educational",
|
|
7844
|
-
"violence-fictional",
|
|
7845
|
-
"violence-support-prevention",
|
|
7846
|
-
"self-harm-thoughts",
|
|
7847
|
-
"self-harm-preparation",
|
|
7848
|
-
"self-harm-act",
|
|
7849
|
-
"self-harm-methods",
|
|
7850
|
-
"self-harm-encouragement",
|
|
7851
|
-
"self-harm-documentary",
|
|
7852
|
-
"self-harm-educational",
|
|
7853
|
-
"self-harm-fictional",
|
|
7854
|
-
"self-harm-support-prevention",
|
|
7855
|
-
"harassment-abuse",
|
|
7856
|
-
"harassment-intimidation",
|
|
7857
|
-
"harassment-threat",
|
|
7858
|
-
"harassment-sexual",
|
|
7859
|
-
"harassment-encouragement",
|
|
7860
|
-
"harassment-fictional",
|
|
7861
|
-
"hate-abuse",
|
|
7862
|
-
"hate-dehumanization",
|
|
7863
|
-
"hate-inferiority",
|
|
7864
|
-
"hate-exclusion",
|
|
7865
|
-
"hate-threat",
|
|
7866
|
-
"hate-historical",
|
|
7867
|
-
"hate-fictional",
|
|
7868
|
-
"criminal-activity-demonstration",
|
|
7869
|
-
"criminal-activity-preparation",
|
|
7870
|
-
"criminal-activity-request",
|
|
7871
|
-
"criminal-activity-instructions",
|
|
7872
|
-
"criminal-activity-promotion",
|
|
7873
|
-
"criminal-activity-substances",
|
|
7874
|
-
"criminal-activity-fraud",
|
|
7875
|
-
"criminal-activity-fictional"
|
|
7876
|
-
];
|
|
7877
7877
|
const docPropertyInfo = createMetaType({ id: "docPropertyInfo" });
|
|
7878
7878
|
/**
|
|
7879
7879
|
* Optional analyses a request can turn on with `processingOptions.features.<id>`. The catalog is
|
|
@@ -7886,7 +7886,7 @@ const createFeatureOptionsSchemas = (booleanSchema) => {
|
|
|
7886
7886
|
const enabled = booleanSchema.meta(metaStore([docPropertyInfo({ description: "Whether to run the feature. Every feature is off unless this is true." })]));
|
|
7887
7887
|
return {
|
|
7888
7888
|
ocr: zod.object({ enabled }).strict().meta(metaStore([docPropertyInfo({
|
|
7889
|
-
description: "Extract
|
|
7889
|
+
description: "Extract text onto the image asset and run an additional text moderation pass. Applies to images, including those extracted from multimedia documents and websites.",
|
|
7890
7890
|
namedType: "OcrFeatureOptions"
|
|
7891
7891
|
})])),
|
|
7892
7892
|
personDetection: zod.object({ enabled }).strict().meta(metaStore([docPropertyInfo({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@calmlens/sdk",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.3",
|
|
4
4
|
"description": "Official CalmLens SDK for JavaScript and TypeScript: content moderation, asset storage and CDN delivery.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://calmlens.com/docs/sdk/javascript",
|