@01-edu/shared 2.0.5 → 2.0.7
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/attrs-defs.js +1 -0
- package/dist/attrs.js +1 -0
- package/dist/bin/check-definitions.js +3 -0
- package/dist/chunk-727IHWVW.js +1 -0
- package/dist/chunk-7ZTI6THC.js +1 -0
- package/dist/chunk-CBWHFDVB.js +1 -0
- package/dist/chunk-EI7MMDWY.js +1 -0
- package/dist/chunk-EOY6G4KE.js +1 -0
- package/dist/chunk-K5Z4W5GV.js +1 -0
- package/dist/chunk-LDUPRVV4.js +1 -0
- package/dist/chunk-NQCTSDJE.js +1 -0
- package/dist/chunk-V47RDOUO.js +1 -0
- package/dist/chunk-XYW3ROIR.js +1 -0
- package/dist/definitions-checker.js +1 -0
- package/dist/event-utils.js +1 -0
- package/dist/games-utils.js +1 -0
- package/dist/graph.js +1 -0
- package/dist/hasura-core.js +1 -0
- package/dist/hasura-model.js +34 -0
- package/dist/hasura-prepare.js +1 -0
- package/dist/modular-steps-utils.js +1 -0
- package/dist/object-structure.js +1 -0
- package/dist/onboarding.js +1 -0
- package/dist/path.js +1 -0
- package/dist/qa-utils.js +1 -0
- package/dist/score.js +1 -0
- package/dist/skill-definitions.js +1 -0
- package/dist/toolbox.js +1 -0
- package/package.json +17 -6
- package/attrs-defs.js +0 -4273
- package/attrs.js +0 -423
- package/bin/check-definitions.js +0 -74
- package/definitions-checker.js +0 -233
- package/event-utils.js +0 -58
- package/graph.js +0 -96
- package/hasura-core.js +0 -217
- package/hasura-model.js +0 -138
- package/hasura-prepare.js +0 -44
- package/languages.js +0 -147
- package/onboarding.js +0 -25
- package/path.js +0 -73
- package/programming-languages.js +0 -21
- package/qa-utils.js +0 -13
- package/score.js +0 -80
- package/skill-definitions.js +0 -359
- package/toolbox.js +0 -532
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import{a as u}from"./chunk-EI7MMDWY.js";var K=u(o=>(t,e="id",c="Int")=>{let i=`${e}_list`,d=o(`
|
|
2
|
+
mutation insert_${t} ($objects: [${t}_insert_input!]!){
|
|
3
|
+
insert_${t} (objects: $objects) { returning { ${e} } }
|
|
4
|
+
}`),l=o(`
|
|
5
|
+
mutation update_${t} ($${e}: ${c}!, $changes: ${t}_set_input!) {
|
|
6
|
+
update_${t} (where: {${e}: {_eq: $${e}}}, _set: $changes) { affected_rows }
|
|
7
|
+
}`),_=o(`
|
|
8
|
+
mutation update_${t} ($${i}: [${c}!], $changes: ${t}_set_input!) {
|
|
9
|
+
update_${t} (where: {${e}: {_in: $${i}}}, _set: $changes) { affected_rows }
|
|
10
|
+
}`),h=o(`
|
|
11
|
+
mutation delete_${t} ($${e}: ${c}!) {
|
|
12
|
+
delete_${t} (where: {${e}: {_eq: $${e}}}) { affected_rows }
|
|
13
|
+
}`),a=o(`
|
|
14
|
+
mutation delete_${t} ($${i}: [${c}!]) {
|
|
15
|
+
delete_${t} (where: {id: {_in: $${i}} }) { affected_rows }
|
|
16
|
+
}`),I=o(`
|
|
17
|
+
query ${t}_count {
|
|
18
|
+
${t}_aggregate { aggregate { count } }
|
|
19
|
+
}`),W=u($=>$[e],"getKey"),j=u(({[e]:$,...s})=>l({[e]:$,changes:s}),"updateOne"),B={key:e,list:i,insertQuery:d,deleteQuery:h,updateQuery:l,updateQueryAll:_,deleteQueryAll:a,remove:u($=>Array.isArray($)?a({[i]:$}):h({[e]:$}),"remove"),update:u(($,s)=>s?Array.isArray(s)?_({changes:$,[i]:s}):l({changes:$,[e]:s}):j($),"update"),add:u(async $=>{let s=Array.isArray($),g=await d.all({objects:s?$:[$]});return s?g[`insert_${t}`].returning.map(W):g[`insert_${t}`].returning[0][e]},"add")};return $=>{let s=`($${e}: ${c}!) {
|
|
20
|
+
${t} (where: {${e}: {_eq: $${e}}} limit: 1) {${e} ${$}}
|
|
21
|
+
}`,g=`($${i}: [${c}!]) {
|
|
22
|
+
${t} (where: {${e}: {_in: $${i}}}) {${e} ${$}}
|
|
23
|
+
}`,w=`($where: ${t}_bool_exp!) {
|
|
24
|
+
${t} (where: $where) {${e} ${$}}
|
|
25
|
+
}`,C=`(
|
|
26
|
+
$where: ${t}_bool_exp!, $orderBy: ${t}_order_by!, $limit: Int!, $offset: Int!,
|
|
27
|
+
) {
|
|
28
|
+
${t} ( order_by: [$orderBy] offset: $offset limit: $limit where: $where ) { ${$} }
|
|
29
|
+
}`,P=`(
|
|
30
|
+
$where: ${t}_bool_exp!, $orderBy: ${t}_order_by!, $limit: Int!, $offset: Int!,
|
|
31
|
+
) {
|
|
32
|
+
${t} ( order_by: [$orderBy] offset: $offset limit: $limit where: $where ) { ${$} }
|
|
33
|
+
${t}_aggregate (where: $where) { aggregate { count } }
|
|
34
|
+
}`,b=o(`query ${s}`),f=o(`query ${g}`),y=o(`query ${w}`),x=o(`query get_${t}_paginate ${C}`),v=o(`query get_${t}_with_count ${P}`),A=o(`subscription ${s}`),Q=o(`subscription ${g}`),q=o(`subscription ${w}`);return{...B,selectQuery:b,selectQueryAll:f,selectQueryWhere:y,subscribeQuery:A,subscribeQueryAll:Q,subscribeQueryWhere:q,get:u(r=>Array.isArray(r)?f({[i]:r}):r&&typeof r=="object"?y({where:r}):b.one(r&&{[e]:r}),"get"),subscribe:u((r,n)=>Array.isArray(n)?Q(r,{[i]:n}):n&&typeof n=="object"?q(r,{where:n}):A.one(r,n&&{[e]:n}),"subscribe"),getCount:u(async r=>(await I(r)).aggregate.count,"getCount"),getPaginated:x,getPaginatedWithCount:u(async r=>{let n=await v.all(r);return{[t]:n[t],count:n[`${t}_aggregate`].aggregate.count}},"getPaginatedWithCount")}}},"buildModel");export{K as buildModel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./chunk-EI7MMDWY.js";var m=e(t=>Object.values(t)[0],"get"),w=e(t=>t,"getAll"),d=e(t=>Object.values(t)[0][0],"getOne"),$=e(({runFromString:t,subscribeFromString:u},s)=>{if(typeof s!="string")throw Error(`Query must be a string but was ${typeof s}`);let[h,o,a]=s.split(/^\s*(\w+)(?:\s+(\w+))?\b/);if(!o)o="query";else if(!/^(subscription|mutation|query)$/.test(o))throw Error("Invalid query, type must be query, mutation or subscription");a||(a=`${o}_${s.split(/{\s*(.+?)\b/)[1]}`);let p=JSON.stringify({query:s}),l=p,b=p.slice(0,-1),f=e(r=>{if(!r)return l;if(typeof r=="function")throw Error("variables should not be functions, verify the order of your parameters");let n=JSON.stringify(r);return n==="{}"?l:`${b},"variables":${n}}`},"build"),c=o==="subscription"?r=>(n,y)=>u(g=>n(r(g)),f(y),a):r=>async n=>r(await t(f(n),a)),i=c(m);return i.all=c(w),i.one=c(d),i.map=c,i.query=s,i},"prepare"),O=e(t=>u=>$(t,u),"initPrepare");export{O as initPrepare,$ as prepare};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as p}from"./chunk-EI7MMDWY.js";var n=["sign-step","upload-step","contact-validation-step","form-step","avatar-step"],o=p(t=>{if(t.type==="sign-step")return`${t.key}Accepted`;if(t.type==="upload-step")return`${t.key}UploadId`;if(t.type==="contact-validation-step")return`${Object.keys(t.attrs.input)[0]}Validated`;if(t.type==="avatar-step")return"avatarUrl"},"getStepKey"),u=p(t=>t.type==="sign-step"?t.attrs.checkbox?.required:t.type==="avatar-step"?t.attrs.input.required:Object.values(t.attrs.input)[0]?.required,"checkRequired"),f=p((t,r)=>t.type==="form-step"?i(t.attrs["form-en"]||t.attrs.form,r.attrs):t.type==="avatar-step"?!!r.avatarUrl:r.attrs[o(t)],"isStepDone"),y=p((t,r)=>{let a=Object.values(t.children).filter(e=>{let s=n.includes(e.type);return s||console.warn(`Step ${e.name} of type ${e.type} is not supported`),s});return!t||!a.length?!0:a.filter(e=>e.type==="form-step"||u(e)).every(e=>f(e,r))},"areStepsDone"),i=p((t,r)=>t.flatMap(({inputs:a})=>a.filter(({required:e})=>e).map(({key:e})=>r[e])).every(Boolean),"checkFields");export{y as areStepsDone,i as checkFields,o as getStepKey,f as isStepDone,n as stepTypes};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c}from"./chunk-K5Z4W5GV.js";import"./chunk-EI7MMDWY.js";export{c as childTypes,b as objectTypes,a as onboardingTypes};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as r}from"./chunk-EI7MMDWY.js";var a=r((n,e)=>{let{prev:t}=(e.parent.type!=="onboarding"?e:e.parent).children[n];return t?t.attrs.status==="succeeded":!0},"prevValidated"),d=r((n,e)=>{let{next:t}=(e.type==="onboarding"?e:e.parent).children[n];return t?t.path:void 0},"nextStep"),i=r(n=>{if(!n)return;let e=Object.values(n.children);return e.find(({attrs:t})=>t.status==="available"||t.status==="failed")||e[e.length-1]},"getOnboardingStep");export{i as getOnboardingStep,d as nextStep,a as prevValidated};
|
package/dist/path.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"./chunk-EOY6G4KE.js";import"./chunk-EI7MMDWY.js";export{a as getAbsolutePath,b as getObjectFromRelativePath};
|
package/dist/qa-utils.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as t}from"./chunk-EI7MMDWY.js";var e=t(r=>r?typeof r=="string"?r:Array.isArray(r)?r.map(e).join(""):e(r.props?.children):"","stringifyJSX"),i=t(r=>e(r).toLowerCase().replace(/([^a-z0-9]+)/g," ").trim().replaceAll(" ","-"),"toTestId");export{e as stringifyJSX,i as toTestId};
|
package/dist/score.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e,f}from"./chunk-CBWHFDVB.js";import"./chunk-EI7MMDWY.js";export{a as gamesScoring,e as getGameScores,f as getGlobalScore,c as getLevelMaxPoints,b as getLevelScore,d as getLevelsScore};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e}from"./chunk-7ZTI6THC.js";import"./chunk-EI7MMDWY.js";export{e as extractHighestSkills,d as hasRequiredSkills,b as skillTiers,c as skillTypes,a as skillsSet};
|
package/dist/toolbox.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,_,a,aa,b,ba,c,ca,d,da,e,ea,f,fa,g,ga,h,ha,i,ia,j,ja,k,ka,l,la,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-LDUPRVV4.js";import"./chunk-V47RDOUO.js";import"./chunk-EI7MMDWY.js";export{h as DAY,g as HOUR,f as MIN,e as SEC,i as WEEK,j as YEAR,U as arrayOf,ha as base64Encode,O as breath,ka as createFrequencyMap,C as dateIsPermanent,G as defer,x as displayDateTime,da as eq,Y as filterEntries,Z as filterValues,J as formatTime,F as formatedDate,D as formatedDateTime,E as formatedDateTimeWithDay,r as formatedDuration,o as formatedDurationColons,p as formatedMS,I as fullName,ga as generateCode,_ as getChanges,ba as getChildByType,z as getDayName,y as getMonthName,ja as getRecordStatus,ea as getStatus,ca as getUserName,a as handleKeyDownEvent,$ as hasChanged,fa as isBanned,M as isNotCamel,b as last,W as mapEntries,X as mapValues,A as monthNames,m as padStart0,la as postgresIntervalToMS,P as prettyKey,l as relativeTime,d as replaceMap,aa as shuffle,H as slugify,s as timeDiff,ia as timePlusDelay,n as timeToMS,q as timeUnits,S as toCamelAll,L as toCamelCase,Q as toCamelKeys,t as toDateFormat,v as toDateFormatWithTime,u as toISOStringWithTimeZone,N as toKebabCase,w as toPermanentDateFormatWithTime,T as toSnakeAll,R as toSnakeKeys,V as trimSlashEnd,k as units,c as upperFirst,K as wait,B as weekDays};
|
package/package.json
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@01-edu/shared",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "",
|
|
6
6
|
"scripts": {
|
|
7
|
+
"prepack": "node build-npm-package.mjs",
|
|
7
8
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
9
|
},
|
|
9
10
|
"files": [
|
|
10
|
-
"./
|
|
11
|
+
"./dist"
|
|
12
|
+
],
|
|
13
|
+
"publicFiles": [
|
|
11
14
|
"./event-utils.js",
|
|
15
|
+
"./games-utils.js",
|
|
12
16
|
"./onboarding.js",
|
|
13
17
|
"./attrs.js",
|
|
14
18
|
"./attrs-defs.js",
|
|
@@ -16,22 +20,29 @@
|
|
|
16
20
|
"./hasura-core.js",
|
|
17
21
|
"./hasura-model.js",
|
|
18
22
|
"./hasura-prepare.js",
|
|
19
|
-
"./languages.js",
|
|
20
23
|
"./definitions-checker.js",
|
|
24
|
+
"./modular-steps-utils.js",
|
|
21
25
|
"./path.js",
|
|
22
|
-
"./programming-languages.js",
|
|
23
26
|
"./score.js",
|
|
24
27
|
"./skill-definitions.js",
|
|
25
28
|
"./toolbox.js",
|
|
26
|
-
"./object-structure.js",
|
|
27
29
|
"./qa-utils.js"
|
|
28
30
|
],
|
|
31
|
+
"sourceFiles": [
|
|
32
|
+
"./object-structure.ts"
|
|
33
|
+
],
|
|
34
|
+
"exports": {
|
|
35
|
+
"./package.json": "./package.json",
|
|
36
|
+
"./*.js": "./dist/*.js",
|
|
37
|
+
"./*.ts": "./dist/*.js",
|
|
38
|
+
"./*": "./dist/*.js"
|
|
39
|
+
},
|
|
29
40
|
"devDependencies": {
|
|
30
41
|
"esbuild": "^0.25.12"
|
|
31
42
|
},
|
|
32
43
|
"license": "Fair",
|
|
33
44
|
"bin": {
|
|
34
|
-
"check-defs": "./bin/check-definitions.js"
|
|
45
|
+
"check-defs": "./dist/bin/check-definitions.js"
|
|
35
46
|
},
|
|
36
47
|
"repository": {
|
|
37
48
|
"type": "git",
|