@donotdev/testing 0.1.42 → 0.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/client/debugIsousou.d.ts.map +1 -1
- package/dist/client/debugIsousou.js +1 -1
- package/dist/client/testEntity.d.ts.map +1 -1
- package/dist/client/testEntity.js +1 -1
- package/dist/client/testImagePipeline.d.ts +0 -11
- package/dist/client/testImagePipeline.d.ts.map +1 -1
- package/dist/client/testImagePipeline.js +1 -1
- package/dist/client/testImageUpload.d.ts +0 -10
- package/dist/client/testImageUpload.d.ts.map +1 -1
- package/dist/client/testImageUpload.js +1 -1
- package/dist/client/testStorage.d.ts +0 -6
- package/dist/client/testStorage.d.ts.map +1 -1
- package/dist/common/index.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debugIsousou.d.ts","sourceRoot":"","sources":["../../src/client/debugIsousou.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"debugIsousou.d.ts","sourceRoot":"","sources":["../../src/client/debugIsousou.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAMzE,MAAM,WAAW,mBAAmB;IAClC,qGAAqG;IACrG,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,4EAA4E;IAC5E,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACxD,wDAAwD;IACxD,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,gCAAgC;IAChC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,0BAA0B;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAMD;;;GAGG;AACH,wBAAsB,YAAY,CAChC,eAAe,EAAE,GAAG,EACpB,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,IAAI,CAAC,CA0Hf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getProvider as p}from"@donotdev/core";import{
|
|
1
|
+
import{getProvider as p}from"@donotdev/core";import{testEntity as h}from"./testEntity";import{testImagePipeline as S}from"./testImagePipeline";import{testImageUpload as d}from"./testImageUpload";import{testStorage as f}from"./testStorage";async function b(a,l={}){const{pipeline:i,crudFns:c,pictures:e,files:r,skipStorage:g=!1,skipPipeline:u=!1,skipCrud:m=!1}=l,o=p("storage"),w=p("crud"),P=p("callable"),n={reference:`TEST-${Date.now().toString(36).toUpperCase()}`,address:{formatted_address:"1 rue de Rivoli, 75001 Paris, France",latitude:48.8606,longitude:2.3376},district_code:1};if(!g){const t=await f({storage:o}),s=await f({storage:o,storagePath:"test"});if(!(!t.passed&&s.passed)&&!(t.passed&&!s.passed)&&!t.passed&&!s.passed)return}if(!u){const t={...n};if(e&&e.length>0&&(t.pictures=e),await S({entity:a,input:t,fns:c}),i&&(await d({fns:i}),r&&r.length>0))for(const s of r)await d({fns:i,file:s})}!m&&a&&await h(a,{providers:{crud:w,storage:o,callable:P},payload:{...n,...e&&e.length>0?{pictures:e}:{}}})}export{b as debugIsousou};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testEntity.d.ts","sourceRoot":"","sources":["../../src/client/testEntity.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,EAAY,KAAK,MAAM,EAAoB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"testEntity.d.ts","sourceRoot":"","sources":["../../src/client/testEntity.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,EAAY,KAAK,MAAM,EAAoB,MAAM,gBAAgB,CAAC;AASzE,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAGjB,MAAM,iBAAiB,CAAC;AA4GzB;;;;;;;;;;;;GAYG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,gBAAgB,CAAC,CA8K3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EDITABLE as v}from"@donotdev/core";import{
|
|
1
|
+
import{EDITABLE as v}from"@donotdev/core";import{createTestImageBlob as D,createTestFileBlob as P}from"./testStorage";import{generatePayload as $,getFileFields as C,isMultiFileField as F}from"../common/payloadGenerator";import{reportEntity as M}from"../common/reporter";async function y(a,g){const r=performance.now();try{const o=await g();return{step:a,passed:!0,duration:Math.round(performance.now()-r),data:o}}catch(o){return{step:a,passed:!1,duration:Math.round(performance.now()-r),error:o instanceof Error?o.message:String(o),errorDetail:o}}}async function _(a,g,r,o){const w=[],i={};for(const l of a){const p=["image","images","avatar"].includes(l.type),u=F(l),d=l.options?.fieldSpecific?.storagePath??r,h=p?"upload-image":"upload-file",s=await y(h,async()=>{const t=p?D():P(),E=p?"png":"txt",f=`dndev_test_${l.name}_${Date.now()}.${E}`,m=await g.upload(t,{storagePath:d,filename:f,signal:o,onProgress:e=>{}});if(p){const e={fullUrl:m.url,thumbUrl:m.url};i[l.name]=u?[e]:e}else{const e={url:m.url,filename:f,size:t.size,mimeType:t.type};i[l.name]=u?[e]:e}return m});w.push({...s,step:`${h}`}),s.passed||(i[l.name]=u?[]:null)}return{results:w,values:i}}async function k(a,g){const{providers:r,payload:o,cleanup:w=!0,skip:i=[],storagePath:l,signal:p}=g,{crud:u}=r,d=a.collection,h=performance.now(),s=[];let t;const E=await y("generate-payload",async()=>$(a.fields,o));if(s.push(E),!E.passed)return T(a,d,s,t,void 0,h);let f=E.data;const m=C(a.fields);if(m.length>0&&r.storage){const{results:e,values:n}=await _(m,r.storage,l,p);s.push(...e),f={...f,...n}}else m.length>0&&r.storage;if(!i.includes("create")){const e=await y("create",async()=>{const n=await u.add(d,f);return t=n.id,n});if(s.push(e),!e.passed)return T(a,d,s,t,f,h)}if(!i.includes("get")&&t){const e=await y("get",async()=>{const n=await u.get(d,t);if(!n)throw new Error(`get returned null for id=${t}`);return n});s.push(e)}if(!i.includes("list")){const e=await y("list",async()=>{const n=await u.query(d,{limit:5});if(t){const b=n.items.some(c=>c.id===t)}return n});s.push(e)}if(!i.includes("listCard")){const e=await y("listCard",async()=>await u.query(d,{limit:5},void 0,"listCard"));s.push(e)}if(!i.includes("update")&&t){const e=await y("update",async()=>{const n=Object.values(a.fields).find(c=>c.type==="text"&&c.editable!==!1&&c.editable!==v.GENERATED&&c.editable!==v.COMPUTED&&c.editable!==v.CREATE_ONLY&&c.visibility!=="hidden"&&c.visibility!=="technical"),b=n?{[n.name]:`updated_${Date.now().toString(36)}`}:{};return Object.keys(b).length===0?{skipped:!0}:(await u.update(d,t,b),b)});s.push(e)}if(!i.includes("delete")&&t&&w){const e=await y("delete",async()=>{await u.delete(d,t)});s.push(e)}return T(a,d,s,t,f,h)}function T(a,g,r,o,w,i){const l={entity:a.name,collection:g,passed:r.every(p=>p.passed),steps:r,createdId:o,payload:w,duration:Math.round(performance.now()-i)};return M(l),l}export{k as testEntity};
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Deterministic CRUD pipeline test - pure data, no browser APIs.
|
|
3
|
-
*
|
|
4
|
-
* Input: entity definition + form object (like the store/UI would give)
|
|
5
|
-
* Process: real framework code (generate → validate → metadata → adapter)
|
|
6
|
-
* Output: the exact payload that Supabase/Firebase would receive
|
|
7
|
-
*
|
|
8
|
-
* @version 0.2.0
|
|
9
|
-
* @since 0.1.0
|
|
10
|
-
* @author AMBROISE PARK Consulting
|
|
11
|
-
*/
|
|
12
1
|
import type { TestImagePipelineOptions, TestImagePipelineResult } from '../common/types';
|
|
13
2
|
/**
|
|
14
3
|
* Test the CRUD pipeline as pure data: form object in → framework processing → adapter payload out.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testImagePipeline.d.ts","sourceRoot":"","sources":["../../src/client/testImagePipeline.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"testImagePipeline.d.ts","sourceRoot":"","sources":["../../src/client/testImagePipeline.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EAIxB,MAAM,iBAAiB,CAAC;AAkCzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,uBAAuB,CAAC,CAqMlC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{generatePayload as U,getFileFields as w}from"../common/payloadGenerator";import{reportImagePipeline as j}from"../common/reporter";async function d(t,a){const u=performance.now();try{const e=await a();return{step:t,passed:!0,duration:Math.round(performance.now()-u),data:e}}catch(e){return{step:t,passed:!1,duration:Math.round(performance.now()-u),error:e instanceof Error?e.message:String(e),errorDetail:e}}}async function v(t){const{entity:a,input:u={},fns:e}=t,y=performance.now(),c=[];let i;const m=await d("generate-payload",async()=>{const o=U(a.fields,u);for(const[r,s]of Object.entries(o)){const l=A(s),f=r in u?" (override)":""}const n=w(a.fields);if(n.length>0)for(const r of n){const s=o[r.name]}return o});if(c.push(m),!m.passed)return b(c,void 0,y);if(i=m.data,e?.validate){const o=await d("upload-pipeline",async()=>{const n=e.validate(i);return typeof n=="object"&&n!==null&&(i=n),n});if(c.push(o),!o.passed)return b(c,i,y)}const p=w(a.fields).filter(o=>["image","images","avatar"].includes(o.type));if(p.length>0){const o=await d("verify-full-url",async()=>{const r=[];for(const s of p){const l=i[s.name];l!=null&&(Array.isArray(l)?l:[l]).forEach((f,g)=>{const h=`${s.name}[${g}]`;f.fullUrl?f.fullUrl.startsWith("blob:")&&r.push(`${h}.fullUrl is blob: ${f.fullUrl}`):r.push(`${h}.fullUrl is empty`)})}if(r.length>0){for(const s of r);throw new Error(`${r.length} URL issue(s): ${r.join("; ")}`)}return{checked:p.length}});c.push(o);const n=await d("verify-thumb-url",async()=>{const r=[];for(const s of p){const l=i[s.name];l!=null&&(Array.isArray(l)?l:[l]).forEach((f,g)=>{const h=`${s.name}[${g}]`;f.thumbUrl?f.thumbUrl.startsWith("blob:")&&r.push(`${h}.thumbUrl is blob: ${f.thumbUrl}`):r.push(`${h}.thumbUrl is empty`)})}if(r.length>0){for(const s of r);throw new Error(`${r.length} thumbUrl issue(s): ${r.join("; ")}`)}return{checked:p.length}});c.push(n)}if(e?.createMetadata){const o=await d("cleanup-image",async()=>{const n=e.createMetadata();for(const[r,s]of Object.entries(n));return i={...i,...n},n});c.push(o)}for(const[o,n]of Object.entries(i));const $=b(c,i,y);return j($),$}function A(t){if(t===null)return"null";if(t===void 0)return"undefined";if(typeof t=="string")return t.length>60?`"${t.slice(0,57)}..."`:`"${t}"`;if(typeof t=="number"||typeof t=="boolean")return String(t);if(Array.isArray(t))return`Array(${t.length})`;if(typeof t=="object"){const a=Object.keys(t);return`{${a.slice(0,4).join(", ")}${a.length>4?", ...":""}}`}return String(t)}function b(t,a,u){return{passed:t.every(e=>e.passed),steps:t,payload:a,duration:Math.round(performance.now()-u)}}export{v as testImagePipeline};
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Browser-side image upload pipeline test — processImage → uploadImage → verify → cleanup
|
|
3
|
-
*
|
|
4
|
-
* Exercises the REAL upload pipeline using injected functions from @donotdev/crud.
|
|
5
|
-
* Runs in browser (requires canvas, fetch). Not for Node/vitest.
|
|
6
|
-
*
|
|
7
|
-
* @version 0.1.0
|
|
8
|
-
* @since 0.1.0
|
|
9
|
-
* @author AMBROISE PARK Consulting
|
|
10
|
-
*/
|
|
11
1
|
import type { TestImageUploadOptions, TestImageUploadResult } from '../common/types';
|
|
12
2
|
/**
|
|
13
3
|
* Create a 100x100 red PNG test image as a File object, with a white diagonal line.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testImageUpload.d.ts","sourceRoot":"","sources":["../../src/client/testImageUpload.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"testImageUpload.d.ts","sourceRoot":"","sources":["../../src/client/testImageUpload.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EAKtB,MAAM,iBAAiB,CAAC;AAMzB;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,SAAmB,GAAG,IAAI,CA6BjE;AAkCD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,qBAAqB,CAAC,CAsMhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{reportImageUpload as
|
|
1
|
+
import{reportImageUpload as E}from"../common/reporter";function U(l="dndev_test.png"){const r=document.createElement("canvas");r.width=100,r.height=100;const e=r.getContext("2d");if(!e)throw new Error("Failed to get canvas 2d context");e.fillStyle="#CC2200",e.fillRect(0,0,100,100),e.strokeStyle="#FFFFFF",e.lineWidth=3,e.beginPath(),e.moveTo(0,0),e.lineTo(100,100),e.stroke();const n=r.toDataURL("image/png").split(",")[1]??"",u=atob(n),c=new Uint8Array(u.length);for(let s=0;s<u.length;s++)c[s]=u.charCodeAt(s);return new File([c],l,{type:"image/png"})}async function p(l,r){const e=performance.now();try{const n=await r();return{step:l,passed:!0,duration:Math.round(performance.now()-e),data:n}}catch(n){return{step:l,passed:!1,duration:Math.round(performance.now()-e),error:n instanceof Error?n.message:String(n),errorDetail:n}}}async function I(l){const{fns:r,storagePath:e,verifyUrls:n=!0,cleanup:u=!0,signal:c}=l,s=l.file??U(),m=performance.now(),h=[];let o,f,d,g;if(r.processImage){const a=await p("process-image",async()=>{const t=await r.processImage(s);return t.fullBlob.size,t.thumbBlob.size,t.fullBlob.type,t.thumbBlob.type,d=t.fullBlob,g=t.thumbBlob,f={fullSize:t.fullBlob.size,thumbSize:t.thumbBlob.size,width:t.width,height:t.height},{fullSize:t.fullBlob.size,thumbSize:t.thumbBlob.size,width:t.width,height:t.height}});if(h.push(a),!a.passed)return w(h,o,f,m)}else d=s,g=s;const b=await p("upload-pipeline",async()=>{const a=await r.uploadImage(d,g,s.name,{storagePath:e,signal:c,onProgress:t=>{}});if(!a.fullUrl)throw new Error("uploadImage returned empty fullUrl");if(!a.thumbUrl)throw new Error("uploadImage returned empty thumbUrl");if(a.fullUrl.startsWith("blob:"))throw new Error(`fullUrl is a blob URL: ${a.fullUrl}`);if(a.thumbUrl.startsWith("blob:"))throw new Error(`thumbUrl is a blob URL: ${a.thumbUrl}`);return o=a,a});if(h.push(b),!b.passed)return w(h,o,f,m);if(n&&o){const a=await p("verify-full-url",async()=>{const i=await fetch(o.fullUrl,{method:"HEAD",signal:c});if(!i.ok)throw new Error(`fullUrl returned HTTP ${i.status}`);return{status:i.status,contentType:i.headers.get("content-type")}});h.push(a);const t=await p("verify-thumb-url",async()=>{const i=await fetch(o.thumbUrl,{method:"HEAD",signal:c});if(!i.ok)throw new Error(`thumbUrl returned HTTP ${i.status}`);return{status:i.status,contentType:i.headers.get("content-type")}});h.push(t)}if(u&&r.deleteImage&&o){const a=await p("cleanup-image",async()=>(await r.deleteImage(o),{deleted:[o.fullUrl,o.thumbUrl]}));h.push(a)}else u&&r.deleteImage;const y=w(h,o,f,m);return E(y),y}function w(l,r,e,n){return{passed:l.every(u=>u.passed),steps:l,picture:r,processed:e,duration:Math.round(performance.now()-n)}}export{U as createTestImageFile,I as testImageUpload};
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Standalone storage adapter test — upload, getUrl, delete
|
|
3
|
-
* @version 0.1.0
|
|
4
|
-
* @since 0.1.0
|
|
5
|
-
* @author AMBROISE PARK Consulting
|
|
6
|
-
*/
|
|
7
1
|
import type { TestStorageOptions, TestStorageResult } from '../common/types';
|
|
8
2
|
/**
|
|
9
3
|
* Generate a minimal valid PNG blob for testing image uploads
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testStorage.d.ts","sourceRoot":"","sources":["../../src/client/testStorage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"testStorage.d.ts","sourceRoot":"","sources":["../../src/client/testStorage.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EAElB,MAAM,iBAAiB,CAAC;AAMzB;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CA0E1C;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAIzC;AAkCD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,iBAAiB,CAAC,CA2C5B"}
|
package/dist/common/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{generatePayload as e,getFileFields as i,isFileField as a,isMultiFileField as t}from"./payloadGenerator";import{reportEntity as
|
|
1
|
+
import{generatePayload as e,getFileFields as i,isFileField as a,isMultiFileField as t}from"./payloadGenerator";import{reportEntity as s,reportStorage as r}from"./reporter";export{e as generatePayload,i as getFileFields,a as isFileField,t as isMultiFileField,s as reportEntity,r as reportStorage};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{testEntity as e}from"./client/testEntity";import{testStorage as a,createTestImageBlob as t,createTestFileBlob as s}from"./client/testStorage";import{testImagePipeline as r}from"./client/testImagePipeline";import{testImageUpload as
|
|
1
|
+
import{testEntity as e}from"./client/testEntity";import{testStorage as a,createTestImageBlob as t,createTestFileBlob as s}from"./client/testStorage";import{testImagePipeline as r}from"./client/testImagePipeline";import{testImageUpload as o,createTestImageFile as i}from"./client/testImageUpload";import{debugIsousou as l}from"./client/debugIsousou";import{debugC4all as m}from"./client/debugC4all";import{generatePayload as p,getFileFields as g,isFileField as d,isMultiFileField as F}from"./common/payloadGenerator";import{reportEntity as I,reportStorage as n,reportImagePipeline as u,reportImageUpload as b}from"./common/reporter";export{s as createTestFileBlob,t as createTestImageBlob,i as createTestImageFile,m as debugC4all,l as debugIsousou,p as generatePayload,g as getFileFields,d as isFileField,F as isMultiFileField,I as reportEntity,u as reportImagePipeline,b as reportImageUpload,n as reportStorage,e as testEntity,r as testImagePipeline,o as testImageUpload,a as testStorage};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@donotdev/testing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@donotdev/core": "^0.
|
|
26
|
+
"@donotdev/core": "^0.2.0"
|
|
27
27
|
},
|
|
28
28
|
"files": [
|
|
29
29
|
"dist",
|
|
@@ -48,4 +48,4 @@
|
|
|
48
48
|
"registry": "https://registry.npmjs.org",
|
|
49
49
|
"access": "public"
|
|
50
50
|
}
|
|
51
|
-
}
|
|
51
|
+
}
|