@proconnect-gouv/proconnect.identite 7.0.1 → 8.1.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/CHANGELOG.md +18 -0
- package/README.md +1 -1
- package/dist/services/organization/compute-service-public-info.d.ts +8 -0
- package/dist/services/organization/compute-service-public-info.d.ts.map +1 -0
- package/dist/services/organization/compute-service-public-info.js +32 -0
- package/dist/services/organization/index.d.ts +1 -1
- package/dist/services/organization/index.d.ts.map +1 -1
- package/dist/services/organization/index.js +1 -1
- package/dist/types/moderation.d.ts +2 -0
- package/dist/types/moderation.d.ts.map +1 -1
- package/dist/types/moderation.js +2 -0
- package/package.json +3 -3
- package/src/services/organization/{is-public-service.test.ts → compute-service-public-info.test.ts} +27 -28
- package/src/services/organization/compute-service-public-info.ts +61 -0
- package/src/services/organization/index.ts +1 -1
- package/src/types/moderation.ts +2 -0
- package/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/services/organization/is-public-service.d.ts +0 -3
- package/dist/services/organization/is-public-service.d.ts.map +0 -1
- package/dist/services/organization/is-public-service.js +0 -29
- package/src/services/organization/is-public-service.ts +0 -51
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { Organization } from "#src/types";
|
|
2
|
-
export declare const isPublicService: ({ cached_categorie_juridique, cached_etat_administratif, siret, }: Pick<Organization, "cached_categorie_juridique" | "cached_etat_administratif" | "siret">) => boolean;
|
|
3
|
-
//# sourceMappingURL=is-public-service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"is-public-service.d.ts","sourceRoot":"","sources":["../../../src/services/organization/is-public-service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAQ/C,eAAO,MAAM,eAAe,GAAI,mEAI7B,IAAI,CACL,YAAY,EACZ,4BAA4B,GAAG,2BAA2B,GAAG,OAAO,CACrE,KAAG,OAiCH,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
import { NATURE_JURIDIQUE_SERVICE_PUBLIC, SERVICE_PUBLIC_BLACKLIST, SERVICE_PUBLIC_WHITELIST, } from "@proconnect-gouv/proconnect.annuaire_entreprises";
|
|
3
|
-
// inspired from https://github.com/annuaire-entreprises-data-gouv-fr/search-infra/blob/4ec29b1ef3370e0f840bd55dd6d38a4811faf18d/workflows/data_pipelines/elasticsearch/data_enrichment.py#L169-L209
|
|
4
|
-
export const isPublicService = ({ cached_categorie_juridique, cached_etat_administratif, siret, }) => {
|
|
5
|
-
// Check if nature juridique is undefined/null
|
|
6
|
-
if (!cached_categorie_juridique) {
|
|
7
|
-
return false;
|
|
8
|
-
}
|
|
9
|
-
const siren = (siret || "").substring(0, 9);
|
|
10
|
-
// Entities in the blacklist are never considered public services
|
|
11
|
-
if (SERVICE_PUBLIC_BLACKLIST.includes(siren)) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
// Closed entities are not considered public services
|
|
15
|
-
if (cached_etat_administratif === "C") {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
// Check if entity is in whitelist (takes priority)
|
|
19
|
-
if (SERVICE_PUBLIC_WHITELIST.includes(siren)) {
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
// Legal nature codes starting with 4 or 7 are public services
|
|
23
|
-
if (cached_categorie_juridique.startsWith("4") ||
|
|
24
|
-
cached_categorie_juridique.startsWith("7")) {
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
// Check if entity has a specific public service legal nature code
|
|
28
|
-
return NATURE_JURIDIQUE_SERVICE_PUBLIC.includes(cached_categorie_juridique);
|
|
29
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
3
|
-
import type { Organization } from "#src/types";
|
|
4
|
-
import {
|
|
5
|
-
NATURE_JURIDIQUE_SERVICE_PUBLIC,
|
|
6
|
-
SERVICE_PUBLIC_BLACKLIST,
|
|
7
|
-
SERVICE_PUBLIC_WHITELIST,
|
|
8
|
-
} from "@proconnect-gouv/proconnect.annuaire_entreprises";
|
|
9
|
-
|
|
10
|
-
// inspired from https://github.com/annuaire-entreprises-data-gouv-fr/search-infra/blob/4ec29b1ef3370e0f840bd55dd6d38a4811faf18d/workflows/data_pipelines/elasticsearch/data_enrichment.py#L169-L209
|
|
11
|
-
export const isPublicService = ({
|
|
12
|
-
cached_categorie_juridique,
|
|
13
|
-
cached_etat_administratif,
|
|
14
|
-
siret,
|
|
15
|
-
}: Pick<
|
|
16
|
-
Organization,
|
|
17
|
-
"cached_categorie_juridique" | "cached_etat_administratif" | "siret"
|
|
18
|
-
>): boolean => {
|
|
19
|
-
// Check if nature juridique is undefined/null
|
|
20
|
-
if (!cached_categorie_juridique) {
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const siren = (siret || "").substring(0, 9);
|
|
25
|
-
|
|
26
|
-
// Entities in the blacklist are never considered public services
|
|
27
|
-
if (SERVICE_PUBLIC_BLACKLIST.includes(siren)) {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Closed entities are not considered public services
|
|
32
|
-
if (cached_etat_administratif === "C") {
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Check if entity is in whitelist (takes priority)
|
|
37
|
-
if (SERVICE_PUBLIC_WHITELIST.includes(siren)) {
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Legal nature codes starting with 4 or 7 are public services
|
|
42
|
-
if (
|
|
43
|
-
cached_categorie_juridique.startsWith("4") ||
|
|
44
|
-
cached_categorie_juridique.startsWith("7")
|
|
45
|
-
) {
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Check if entity has a specific public service legal nature code
|
|
50
|
-
return NATURE_JURIDIQUE_SERVICE_PUBLIC.includes(cached_categorie_juridique);
|
|
51
|
-
};
|