adminapi init

This commit is contained in:
2024-10-30 16:20:47 +01:00
parent 46e4b2b37b
commit 110cf1c2c6
51 changed files with 9100 additions and 2 deletions

5
schema/conf.json Normal file
View File

@@ -0,0 +1,5 @@
{
"schema":"schema/",
"objects":[{"name":"nations","lastversion":0},{"name":"pagans","lastversion":0},{"name":"towns","lastversion":0},{"name":"tribes","lastversion":0}],
"comment":"schema are in english to get translate part a /lg/schemaname_lg.json allow to replace by lg language the relevant key. Each time a modification is done in schema lastupdate take a timestamp"
}

View File

@@ -0,0 +1,63 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "/schema/frenchlocation",
"title": "French adresse location system from https://api-adresse.data.gouv.fr/search/?q=8+bd+du+port+massy that respect GeoCodeJSON",
"description": "Manage properly postal adresse",
"type": "object",
"properties": {
"type": {
"title": "Type of result found, housenumber is a physical adresse, street position at street, locality: lieud it, municipality",
"type": "string"
},
"housenumber":{
"title":"number with ince bis ter A B"
},
"street":{
"title":"Name of street"
},
"name": {
"title": "Number plaque and street name (no town)",
"type": "string"
},
"label": {
"title": "Full address description number type of street, name of street Postal code Town name",
"type": "string"
},
"postcode": {
"title": "5 numbers french Post code",
"pattern": "^[0-9]{5}$"
},
"citycode": {
"title": "code INSEE",
"type": "string"
},
"city": {
"title": "City name",
"type": "string"
},
"zoning":{
"title":"Number of kilometer around this position",
"type":"integer",
"minimum":0
},
"position": {
"type": "object",
"properties": {
"latitude": {
"type": "number",
"minimum": -90.0,
"maximum": 90.0
},
"longitude": {
"type": "number",
"minimum": -180.0,
"maximum": 180.0
}
}
},
"context": {
"title": "Contexte of this address Department number, Department Name, Region ",
"type": "string"
}
}
}

275
schema/lg/httperror_en.json Normal file
View File

@@ -0,0 +1,275 @@
{
"100": {
"description": "Continue",
"examples": [
"Continue with the data transfer.",
"You may proceed with the next part of the request.",
"The server is ready for the next step in the request."
]
},
"101": {
"description": "Switching Protocols",
"examples": [
"The server is changing the protocol on the request.",
"The protocol used for this request is being upgraded.",
"Switching to a different communication protocol."
]
},
"200": {
"description": "OK",
"examples": [
"The operation was successful.",
"The request has been successfully completed.",
"Everything is fine, and the request is successful."
]
},
"201": {
"description": "Created",
"examples": [
"A new resource has been successfully created.",
"The request resulted in the creation of a new resource.",
"Your request has led to the creation of a new item."
]
},
"202": {
"description": "Accepted",
"examples": [
"The request has been accepted for processing.",
"Your request has been acknowledged and queued for processing.",
"We've received your request and will take action."
]
},
"204": {
"description": "No Content",
"examples": [
"The request was successful, but there is no response body.",
"Your request was processed, but there's nothing to show in the response.",
"This request did not return any content."
]
},
"206": {
"description": "Partial Content",
"examples": [
"The server is returning part of the requested data.",
"You requested a range of data, and we're sending a portion of it.",
"Here's a partial response to your request."
]
},
"300": {
"description": "Multiple Choices",
"examples": [
"The request has multiple possible responses, and the user or client must choose one.",
"We can fulfill your request in several ways. Please choose one.",
"You have multiple options for the requested resource."
]
},
"301": {
"description": "Moved Permanently",
"examples": [
"The requested resource has permanently moved to a new location.",
"This resource is no longer available here; it's moved to a new address.",
"The URL you're looking for has been permanently redirected."
]
},
"302": {
"description": "Found",
"examples": [
"The requested resource is temporarily located at a different URL.",
"You can find what you're looking for at a different address for now.",
"The resource you want is temporarily located elsewhere."
]
},
"304": {
"description": "Not Modified",
"examples": [
"The requested resource has not been modified since the specified time.",
"Your cached data is still up-to-date; there have been no changes.",
"The server confirms that your data is current."
]
},
"400": {
"description": "Bad Request",
"examples": [
"The request is malformed or invalid.",
"Something is wrong with the request parameters.",
"Your request does not meet the server's requirements."
]
},
"401": {
"description": "Unauthorized",
"examples": [
"Authentication is required, and the user or client failed to provide valid credentials.",
"You must log in or provide valid credentials to access this resource.",
"Access is restricted. Please provide valid authentication."
]
},
"403": {
"description": "Forbidden",
"examples": [
"Access to the requested resource is forbidden.",
"You do not have permission to access this resource.",
"Sorry, but you're not allowed to access this."
]
},
"404": {
"description": "Not Found",
"examples": [
"The requested resource does not exist on the server.",
"The server could not find the page you're looking for.",
"Sorry, but what you're searching for isn't here."
]
},
"405": {
"description": "Method Not Allowed",
"examples": [
"The HTTP method used in the request is not allowed for the requested resource.",
"The server does not support the method you're trying to use.",
"This resource does not allow the requested HTTP method."
]
},
"406": {
"description": "Not Acceptable",
"examples": [
"The requested resource cannot provide a response that is acceptable according to the request's headers.",
"We cannot provide the response you expect based on your request headers.",
"Sorry, but we can't fulfill your request as specified."
]
},
"407": {
"description": "Proxy Authentication Required",
"examples": [
"Authentication is required to access the requested resource via a proxy.",
"To access this resource through a proxy, you must provide valid authentication.",
"Please provide valid credentials for proxy access."
]
},
"408": {
"description": "Request Timeout",
"examples": [
"The server did not receive a complete request within the expected time.",
"Your request took too long to arrive at the server.",
"Sorry, your request has timed out."
]
},
"409": {
"description": "Conflict",
"examples": [
"The request could not be completed due to a conflict with the current state of the target resource.",
"There's a conflict with the current state of the resource; please try again.",
"Sorry, there's a conflict with the requested action."
]
},
"410": {
"description": "Gone",
"examples": [
"The requested resource is no longer available and has been intentionally removed.",
"The resource you're looking for is gone and will not return.",
"This resource has been permanently removed."
]
},
"411": {
"description": "Length Required",
"examples": [
"The server requires a content length to be specified in the request headers.",
"Your request is missing a required content length header.",
"Please include a 'Content-Length' header in your request."
]
},
"412": {
"description": "Precondition Failed",
"examples": [
"A precondition in the request headers was not met.",
"The server expected certain conditions to be met, but they were not.",
"Sorry, the required conditions were not fulfilled."
]
},
"413": {
"description": "Request Entity Too Large",
"examples": [
"The request entity is too large for the server to process.",
"Your request body is too big for us to handle.",
"Please reduce the size of your request entity."
]
},
"414": {
"description": "Request-URI Too Long",
"examples": [
"The URI provided in the request is too long for the server to process.",
"The URL in your request is excessively long; please shorten it.",
"The request URI you provided is too lengthy."
]
},
"415": {
"description": "Unsupported Media Type",
"examples": [
"The server cannot process the request because the media type is not supported.",
"We cannot handle the content type you specified.",
"Sorry, we do not support the requested media type."
]
},
"416": {
"description": "Requested Range Not Satisfiable",
"examples": [
"The requested range cannot be satisfied by the server.",
"We cannot provide the content range you requested.",
"Sorry, but we cannot fulfill the requested content range."
]
},
"417": {
"description": "Expectation Failed",
"examples": [
"The server could not meet the expectations specified in the request's Expect header.",
"We were unable to fulfill the expectations you set in your request headers.",
"Sorry, but we could not meet your expectations."
]
},
"500": {
"description": "Internal Server Error",
"examples": [
"Something went wrong on the server's end.",
"We apologize, but an unexpected error occurred.",
"The server is currently experiencing technical difficulties."
]
},
"501": {
"description": "Not Implemented",
"examples": [
"The server does not support the functionality required to fulfill the request.",
"Sorry, but the requested functionality is not available on this server.",
"We have not implemented the feature you're looking for."
]
},
"502": {
"description": "Bad Gateway",
"examples": [
"The server acting as a gateway or proxy received an invalid response from the upstream server.",
"The gateway or proxy received an unexpected response from the upstream server.",
"Sorry, there's an issue with the gateway or proxy."
]
},
"503": {
"description": "Service Unavailable",
"examples": [
"The server is temporarily unavailable to handle the request.",
"We're currently unavailable due to maintenance; please try again later.",
"Sorry, the service is not available right now."
]
},
"504": {
"description": "Gateway Timeout",
"examples": [
"The server acting as a gateway or proxy did not receive a timely response from the upstream server.",
"We're experiencing a timeout while waiting for the upstream server.",
"Sorry, but there's a timeout issue with the gateway."
]
},
"505": {
"description": "HTTP Version Not Supported",
"examples": [
"The HTTP version used in the request is not supported by the server.",
"Your client is using an unsupported HTTP version; please update.",
"Sorry, but we do not support the HTTP version used in your request."
]
}
}

19
schema/lg/nations_fr.json Normal file
View File

@@ -0,0 +1,19 @@
{
"title": "Description d'une nation",
"description":"Nation schema in the apxtri world",
"$comment":"",
"properties":{
"nationId":{
"title":"Nom de nation",
"description":"Nom unique idenbtifiant une nation composé de a-z et de 0-9 permet de fereder des règles de fonctionnement"
},
"dtcreate":{
"title":"Date de creation",
"description":"Creation de la nation"
},
"contracts":{
"title":"Le contrat social",
"description":"Indique l'emplacement du contrat qu'accepte toutes les villes"
}
}
}

14
schema/lg/pagans_fr.json Normal file
View File

@@ -0,0 +1,14 @@
{
"title": "L'identité d'un pagan",
"description": "Decrit les informations de l'identité numérique public",
"properties": {
"publickey": {
"title": "Clé public associés à l'alias",
"description": "Cle public généré par openpgp.js lors de la creation d'un compte"
},
"alias": {
"title": "Alias",
"description": "Chaine de texte memnotechnique qui se retiens plus facilement qu'une clé public"
}
}
}

39
schema/nations.json Normal file
View File

@@ -0,0 +1,39 @@
{
"$schema":"http://json-schema.org/schema#",
"$id":"adminapi/schema/nations",
"title": "Nation definition",
"description": "A nation from apxtri world",
"$comment":"see ./lg/nations_lg.json for description in your languange lg",
"type": "object",
"properties": {
"nationId": {
"title":"Unique nation name",
"description":"A unique string that define a nation a-z and 0-9 onlyin a social world",
"type": "string",
"pattern":"^[a-z0-9]*$"
},
"dtcreate": {
"title":"Creation date",
"description":"Nation date of creation",
"type": "string",
"format":"date-time"
},
"contracts":{
"title":"Social contract of the nation",
"description":"A uri of the signed js contract that rules this nation",
"type": "string",
"format":"uri"
}
},
"required": ["nationId", "dtcreate","contracts"],
"additionalProperties":false,
"apxid":"nationId",
"apxuniquekey":["nationId"],
"apxidx": [
{ "name":"lst_nationId","type":"array","keyval": "nationId"},
{ "name":"nations","type":"view","keyval":"nationId","objkey":[],"filter":""}
],
"apxaccessrights":{
"pagan":{"C":[],"R":[]}
}
}

52
schema/pagans.json Normal file
View File

@@ -0,0 +1,52 @@
{
"$id": "https://smatchit.io/schema/pagan",
"$comment": "To create account bin apxtri",
"title": "Pagans identity",
"description": "A numeric id in the nationchains world",
"type": "object",
"properties": {
"publickey": {
"title": "Alias's publickey",
"description": "Public key generate with openpgp.js",
"type": "string",
"format": "pgppublickey"
},
"alias": {
"title": "Alias",
"description": "text to remember easily a public key",
"type": "string",
"minLength": 3,
"pattern": "^[a-z0-9]*$"
},
"dt_delete": {
"title": "Date of death",
"description": "Date of alias delete request, your will will be apply",
"type": "string",
"format": "date-time"
},
"will": {
"title": "Will script after death",
"description": "This will script will be apply on your data 30 days after your alias death",
"type": "string"
}
},
"required": ["publickey", "alias"],
"apxid": "alias",
"apxuniquekey": ["publickey"],
"apxidx": [
{ "name": "lst_alias", "type": "array", "keyval": "alias" },
{
"name": "alias",
"type": "view",
"keyval": "alias",
"objkey": [],
"filter": ""
}
],
"apxaccessrights": {
"owner": { "R": [], "U": [], "D": [] },
"anonymous": { "C": [], "R": ["alias"] },
"pagans": { "R": ["alias", "publickey"] },
"mayor": { "R": [], "D": [] }
}
}

69
schema/screens.json Normal file
View File

@@ -0,0 +1,69 @@
{
"$id": "https://smatchit.io/schema/screens",
"$comment": "To describe screens as tree to navigate inside",
"title": "Screens description",
"description": "Each propertie value is a mustache template string where a data must be provide to display screen with value",
"type": "object",
"properties": {
"screenid":{
"title":"Screen identification used in html tag id",
"type":"string"
},
"title": {
"title": "A title in a screen",
"type": "string"
},
"subtitle": {
"title": "A subtitle in a screen",
"type": "string"
},
"icon": {
"title": "an icon name",
"type": "string"
},
"warning": {
"title": "A text to highlight something, this text is between 2 ! icon",
"type": "string"
},
"formcontrol": {
"title": "A key word to presents this content",
"type": "string",
"enum":["squarebluebtn","listbtn","form"]
},
"forms":{
"title":"Liste of data collection element into the screen",
"type":"array",
"items":{"type":"objects"}
},
"action": {
"title": "List of possible action on this element",
"type": "string",
"enum":["onclick"]
},
"function":{
"title":"Function name to call, if action",
"comment":"other function than nextlevel",
"type":"string"
},
"params":{
"title":" an object containning parameter to send to function",
"comment":"can be empty {}",
"type":"objects"
},
"nextlevel":{
"title":"List of new screens to show if function is nextlevel $ref:# means it same current schema",
"type":"array",
"items":{"$ref":"#"}
}
},
"required": ["screenid", "title"],
"apxid": "screenid",
"apxuniquekey": ["screenid"],
"apxidx": [
{ "name": "lst_screens", "type": "array", "keyval": "screenid" },
],
"apxaccessrights": {
"owner": { "R": [], "U": [], "D": [] },
"anonymous": { "R": [] },
}
}

88
schema/towns.json Normal file
View File

@@ -0,0 +1,88 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "schema/towns",
"title": "Town",
"description": "A town belonging to a nation from apxtri world",
"type": "object",
"properties": {
"townId": {
"type": "string",
"pattern": "^[a-z0-9]*$"
},
"nationId": {
"type": "string",
"options": {
"$ref": "adminapi/objects/nations/idx/lst_nations.json"
}
},
"owner": {
"type": "string",
"options": {
"$ref": "adminapi/objects/pagans/idx/lst_alias.json"
}
},
"mayorId": {
"comment": "todo, to be remove by ower in models",
"type": "string",
"options": {
"$ref": "adminapi/objects/pagans/idx/lst_alias.json"
}
},
"IP": {
"comment": "IP adress where the dns answer to access in direct to this IP into a /etc/hosts or private dns",
"type": "string"
},
"status": {
"title": "The current status of this town",
"description": "Unchain is used for dev they are no public domain, chain means that a public domain name is available, elected means the consensus make this town as the master of adminapi data. A town is elected for a period of time necessary to get new election",
"default": "unchain",
"type": "string",
"enum": [
"unchain",
"chain",
"elected"
]
},
"dns": {
"type": "string"
}
},
"required": [
"townId",
"status",
"nationId",
"dns"
],
"apxid": "townId",
"apxuniquekey": [
"townId",
"dns"
],
"apxidx": [
{
"name": "lst_townId",
"type":"array",
"keyval": "townId"
},
{
"name": "towns",
"keyval": "townId",
"type": "view",
"objkey": [],
"filter": ""
}
],
"apxaccessrights": {
"pagan": {
"C": [],
"R": []
},
"owner": {
"D": [],
"U": [
"owner",
"status"
]
}
}
}

110
schema/tribes.json Normal file
View File

@@ -0,0 +1,110 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "nationchains/schema/tribes",
"title": "Tribes",
"description": "A tribe belonging to a town",
"type": "object",
"properties": {
"tribeId": {
"type": "string",
"pattern": "^[a-z0-9]*$"
},
"townId": {
"type": "string",
"options": {
"$ref": "adminapi/objects/towns/idx/lst_towns.json"
}
},
"nationId": {
"type": "string",
"options": {
"$ref": "adminapi/objects/nations/idx/lst_nations.json"
}
},
"owner": {
"type": "string",
"options": {
"$ref": "adminapi/objects/nations/idx/lst_alias.json"
}
},
"dns": {
"type": "array",
"items": {
"type": "string"
}
},
"context": {
"type": "object",
"comments": "Check if necessary generate by apxtri.js detail route model available"
}
},
"required": [
"townId",
"status",
"nationId",
"dns"
],
"apxid": "tribeId",
"apxuniquekey": [
"tribeId"
],
"apxidx": [
{
"name": "lst_tribeId",
"keyval": "tribeId",
"type": "array"
},
{
"name": "tribes",
"keyval": "tribeId",
"type": "view",
"objkey": [],
"filter": ""
},
{
"name": "owner_tribeId",
"type": "distribution",
"keyval": "owner",
"objkey": [
"tribeId"
]
},
{
"name": "dns_tribeId",
"type": "distribution",
"keyval": "dns",
"objkey": [
"tribeId"
]
},
{
"name": "tribes_dns",
"keyval": "tribeId",
"type": "view",
"objkey": [
"dns"
],
"filter": ""
}
],
"apxacceesrights": {
"owner": {
"D": [],
"U": [
"owner",
"dns"
]
},
"druid": {
"R": [],
"U": []
},
"mayor": {
"C": [],
"R": []
},
"pagan": {
"R": []
}
}
}

131
schema/wwws.json Normal file
View File

@@ -0,0 +1,131 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "nationchains/schema/www",
"title": "www",
"description": "A space web available for a domaine, with accessright",
"type": "object",
"properties": {
"tribeId": {
"title": "Tribe name",
"description": "A unique string as tribe",
"options": {
"$ref": "adminapi/objects/tribess/idx/lst_tribeId.json"
}
},
"website": {
"description": "Folder name into a tribeId/www/",
"title": "web space",
"type": "string"
},
"status": {
"title": "Status",
"description": "Status of website ",
"default": "active",
"type": "string",
"enum": [
"chain",
"tochain",
"unchain"
]
},
"dns": {
"title": "domaine name list to access",
"description": "Add in nginx nameserver local website.tribeId LAN domaine.tld",
"type": "array",
"items": {
"type": "string"
}
},
"apxtri": {
"title": "apxtri value to use in a front end project",
"type": "object",
"properties": {
"headers": {
"type": "object",
"properties": {
"xtrkversion": {
"type": "integer",
"default": 1
},
"xalias": {
"type": "string",
"default": "anonymous"
},
"xapp": {
"type": "string",
"comment": "the website"
},
"xdays": {
"type": "integer",
"default": 0
},
"xhash": {
"type": "string",
"default": "anonymous"
},
"xlang": {
"type": "string",
"default": "en"
},
"xprofils": {
"type": "string",
"default": "anonymous"
},
"xtribe": {
"type": "string",
"comment": "the tribeid"
},
"xuuid": {
"type": "string""default": 0
}
},
"required": [
"xtrkversion",
"xalias",
"xapp",
"xdays",
"xhash",
"xlang",
"xprofils",
"xtribe",
"xuuid"
]
}
},
"required": [
"headers"
]
},
"pages": {
"title": "a page name of a front end",
"description": "Those obejct allow to run a request like https://dns[]/api/adminapi/localdb(anonymous|)/tribeId/website/pagesname/version to return some contexte items are collection of object items @todo explain list of possible",
"type": "object"
}
},
"required": [
"tribeId",
"website",
"status"
],
"apxid": "website",
"apxidx": [
{
"name": "lst_website",
"type": "array",
"keyval": "website"
}
],
"apxaccessrights": {
"owner": {
"D": [],
"R": [],
"U": []
},
"mayor": {
"C": []
},
"person": {
"R": []
}
}
}