@orieljs/framework 0.1.0-alpha.15 → 0.1.0-alpha.16
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/{chunk-GCMPAXIK.js → chunk-3QHTNAMZ.js} +6 -4
- package/dist/{chunk-GCMPAXIK.js.map → chunk-3QHTNAMZ.js.map} +1 -1
- package/dist/{chunk-BKA5F3TH.js → chunk-6AXJB4CD.js} +5 -1
- package/dist/chunk-6AXJB4CD.js.map +1 -0
- package/dist/{chunk-7GPMFMS7.js → chunk-MG4YEWMV.js} +1239 -488
- package/dist/chunk-MG4YEWMV.js.map +1 -0
- package/dist/{chunk-FVI6X3VJ.js → chunk-YNDMTTWL.js} +114 -8
- package/dist/chunk-YNDMTTWL.js.map +1 -0
- package/dist/contracts.d.ts +112 -1
- package/dist/contracts.js +5 -1
- package/dist/{index.d-lffxurFs.d.ts → index.d-DA-Iu2a2.d.ts} +39 -2
- package/dist/index.d.ts +2780 -2137
- package/dist/index.js +1410 -543
- package/dist/index.js.map +1 -1
- package/dist/{jsx-runtime-Bc5KJzwb.d.ts → jsx-runtime-CenT41Y0.d.ts} +1 -1
- package/dist/jsx-runtime.d.ts +2 -2
- package/dist/jsx-runtime.js +3 -3
- package/dist/{testing-CVpo7aRl.d.ts → testing-B8J_HhF4.d.ts} +6 -2
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +3 -3
- package/docs/authentication.md +45 -3
- package/docs/authorization.md +2 -4
- package/docs/cache.md +29 -5
- package/docs/configuration.md +84 -7
- package/docs/console.md +41 -2
- package/docs/container.md +4 -0
- package/docs/csrf.md +2 -2
- package/docs/database.md +22 -0
- package/docs/deployment.md +39 -17
- package/docs/eloquent-factories.md +4 -3
- package/docs/eloquent-mutators.md +2 -1
- package/docs/eloquent-relationships.md +28 -3
- package/docs/eloquent-resources.md +253 -0
- package/docs/eloquent.md +41 -0
- package/docs/errors.md +12 -3
- package/docs/events.md +3 -1
- package/docs/facades.md +1 -0
- package/docs/helpers.md +33 -2
- package/docs/inertia.md +11 -2
- package/docs/installation.md +4 -2
- package/docs/laravel.md +71 -0
- package/docs/lifecycle.md +5 -2
- package/docs/live.md +88 -8
- package/docs/mail.md +28 -3
- package/docs/middleware.md +20 -12
- package/docs/navigation.json +8 -0
- package/docs/notifications.md +22 -0
- package/docs/pagination.md +4 -0
- package/docs/passwords.md +4 -6
- package/docs/providers.md +3 -5
- package/docs/queues.md +64 -2
- package/docs/requests.md +42 -3
- package/docs/responses.md +7 -4
- package/docs/routing.md +85 -7
- package/docs/scheduling.md +25 -0
- package/docs/session.md +2 -2
- package/docs/starter-kits.md +26 -7
- package/docs/storage.md +10 -4
- package/docs/testing.md +10 -2
- package/docs/two-factor.md +34 -1
- package/docs/upgrade.md +111 -2
- package/docs/validation.md +70 -9
- package/docs/views.md +1 -0
- package/docs/vite.md +2 -1
- package/package.json +43 -35
- package/dist/chunk-7GPMFMS7.js.map +0 -1
- package/dist/chunk-BKA5F3TH.js.map +0 -1
- package/dist/chunk-FVI6X3VJ.js.map +0 -1
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Application,
|
|
3
3
|
ConfigRepository,
|
|
4
|
-
Container
|
|
5
|
-
|
|
4
|
+
Container,
|
|
5
|
+
ExceptionHandler,
|
|
6
|
+
HttpRequest,
|
|
7
|
+
LogManager
|
|
8
|
+
} from "./chunk-6AXJB4CD.js";
|
|
6
9
|
|
|
7
10
|
// ../Container/dist/index.js
|
|
8
11
|
import { AsyncLocalStorage } from "async_hooks";
|
|
@@ -973,10 +976,10 @@ var Collection = class _Collection {
|
|
|
973
976
|
* negative or fractional index throws a RangeError, as put() does.
|
|
974
977
|
*/
|
|
975
978
|
replace(items) {
|
|
976
|
-
const
|
|
979
|
+
const copy2 = this.newInstance(this.items);
|
|
977
980
|
const entries = Symbol.iterator in items ? [...items].map((value2, index) => [index, value2]) : Object.entries(items).map(([index, value2]) => [Number(index), value2]);
|
|
978
|
-
for (const [index, value2] of [...entries].sort((a, b) => a[0] - b[0]))
|
|
979
|
-
return
|
|
981
|
+
for (const [index, value2] of [...entries].sort((a, b) => a[0] - b[0])) copy2.put(index, value2);
|
|
982
|
+
return copy2;
|
|
980
983
|
}
|
|
981
984
|
// ---------------------------------------------------------------- building collections
|
|
982
985
|
/** One level of nested arrays and collections, merged (other items are dropped). */
|
|
@@ -2963,12 +2966,91 @@ var Arr = {
|
|
|
2963
2966
|
return index === -1 ? defaultValue : items[index];
|
|
2964
2967
|
}
|
|
2965
2968
|
};
|
|
2969
|
+
function serializeDate(date) {
|
|
2970
|
+
return date.toISOString().replace(/\.(\d{3})Z$/, ".$1000Z");
|
|
2971
|
+
}
|
|
2972
|
+
var flatKeys = (keys) => keys.flatMap((key) => typeof key === "string" ? [key] : [...key]);
|
|
2973
|
+
var isPlainObject = (value2) => {
|
|
2974
|
+
if (typeof value2 !== "object" || value2 === null) return false;
|
|
2975
|
+
const prototype = Object.getPrototypeOf(value2);
|
|
2976
|
+
return prototype === Object.prototype || prototype === null;
|
|
2977
|
+
};
|
|
2978
|
+
function copy(value2) {
|
|
2979
|
+
if (Array.isArray(value2)) return value2.map(copy);
|
|
2980
|
+
if (isPlainObject(value2)) return Object.fromEntries(Object.entries(value2).map(([key, item]) => [key, copy(item)]));
|
|
2981
|
+
return value2;
|
|
2982
|
+
}
|
|
2983
|
+
var ValidatedInput = class _ValidatedInput {
|
|
2984
|
+
#input;
|
|
2985
|
+
constructor(input) {
|
|
2986
|
+
this.#input = input;
|
|
2987
|
+
}
|
|
2988
|
+
all() {
|
|
2989
|
+
return copy(this.#input);
|
|
2990
|
+
}
|
|
2991
|
+
/** The keys given that are there, as `{ key: value }`; a dotted key is nested. */
|
|
2992
|
+
only(...keys) {
|
|
2993
|
+
const results = {};
|
|
2994
|
+
for (const key of flatKeys(keys)) if (Arr.has(this.#input, key)) Arr.set(results, key, copy(Arr.get(this.#input, key)));
|
|
2995
|
+
return results;
|
|
2996
|
+
}
|
|
2997
|
+
/** Everything but the keys given. */
|
|
2998
|
+
except(...keys) {
|
|
2999
|
+
const results = this.all();
|
|
3000
|
+
for (const key of flatKeys(keys)) Arr.forget(results, key);
|
|
3001
|
+
return results;
|
|
3002
|
+
}
|
|
3003
|
+
/** A new input with the values added (replacing the keys they share). */
|
|
3004
|
+
merge(values) {
|
|
3005
|
+
return new _ValidatedInput({ ...this.all(), ...values });
|
|
3006
|
+
}
|
|
3007
|
+
/** Laravel's collect(), as a list: the input's values, or those of the list (or object) at `key`; a value alone is a list of one. */
|
|
3008
|
+
collect(key) {
|
|
3009
|
+
const value2 = key === void 0 ? this.#input : Arr.get(this.#input, key);
|
|
3010
|
+
if (value2 === void 0 || value2 === null) return [];
|
|
3011
|
+
if (Array.isArray(value2)) return copy(value2);
|
|
3012
|
+
if (isPlainObject(value2)) return Object.values(copy(value2));
|
|
3013
|
+
return [value2];
|
|
3014
|
+
}
|
|
3015
|
+
/** Whether every key given is there. */
|
|
3016
|
+
has(...keys) {
|
|
3017
|
+
return flatKeys(keys).every((key) => Arr.has(this.#input, key));
|
|
3018
|
+
}
|
|
3019
|
+
/** The value at `key` (dotted or not), else `defaultValue`; everything without a key. */
|
|
3020
|
+
input(key, defaultValue) {
|
|
3021
|
+
return key === void 0 ? this.all() : copy(Arr.get(this.#input, key, defaultValue));
|
|
3022
|
+
}
|
|
3023
|
+
};
|
|
2966
3024
|
var HIDDEN_SEGMENT = /^\.|\.(ts|tsx|mts|cts)$|[. ]$/i;
|
|
2967
3025
|
var PUBLISHED_DOTFILES = /* @__PURE__ */ new Set([".well-known", ".nojekyll"]);
|
|
2968
3026
|
function isPublicAsset(relativePath) {
|
|
2969
3027
|
const segments2 = relativePath.split(/[\\/]/).filter((segment) => segment !== "");
|
|
2970
3028
|
return !segments2.some((segment, index) => HIDDEN_SEGMENT.test(segment) && !(index === 0 && PUBLISHED_DOTFILES.has(segment)));
|
|
2971
3029
|
}
|
|
3030
|
+
var warned = /* @__PURE__ */ new WeakMap();
|
|
3031
|
+
var quiet = 0;
|
|
3032
|
+
function warnProcessWide(what, hint) {
|
|
3033
|
+
if (quiet > 0) return;
|
|
3034
|
+
const scope = currentContainer();
|
|
3035
|
+
if (scope === void 0 || !scope.bound(HttpRequest) || !scope.bound(Application)) return;
|
|
3036
|
+
const app2 = scope.make(Application);
|
|
3037
|
+
if (!app2.environment("local")) return;
|
|
3038
|
+
let seen = warned.get(app2);
|
|
3039
|
+
if (seen === void 0) warned.set(app2, seen = /* @__PURE__ */ new Set());
|
|
3040
|
+
if (seen.has(what)) return;
|
|
3041
|
+
seen.add(what);
|
|
3042
|
+
const message = `${what} inside a request changes it for every request, not only this one: ${hint}.`;
|
|
3043
|
+
if (scope.bound(LogManager)) scope.make(LogManager).warning(message);
|
|
3044
|
+
else console.warn(message);
|
|
3045
|
+
}
|
|
3046
|
+
function withoutProcessWideWarnings(fn) {
|
|
3047
|
+
quiet++;
|
|
3048
|
+
try {
|
|
3049
|
+
return fn();
|
|
3050
|
+
} finally {
|
|
3051
|
+
quiet--;
|
|
3052
|
+
}
|
|
3053
|
+
}
|
|
2972
3054
|
var ServiceProvider = class {
|
|
2973
3055
|
constructor(app2) {
|
|
2974
3056
|
this.app = app2;
|
|
@@ -2981,7 +3063,7 @@ var ServiceProvider = class {
|
|
|
2981
3063
|
/** Package defaults under `key`; values the app already set win (shallow merge, like Laravel). */
|
|
2982
3064
|
mergeConfigFrom(defaults, key) {
|
|
2983
3065
|
const config2 = this.app.make(ConfigRepository);
|
|
2984
|
-
config2.set(key, { ...defaults, ...config2.get(key, {}) });
|
|
3066
|
+
withoutProcessWideWarnings(() => config2.set(key, { ...defaults, ...config2.get(key, {}) }));
|
|
2985
3067
|
}
|
|
2986
3068
|
};
|
|
2987
3069
|
function facade(abstract, extras) {
|
|
@@ -3079,6 +3161,7 @@ var ClassRegistry = class {
|
|
|
3079
3161
|
}
|
|
3080
3162
|
};
|
|
3081
3163
|
var SCOPE_METHODS = /* @__PURE__ */ new Set(["make", "instance", "bound", "resolved", "forgetInstance", "createScope", "run"]);
|
|
3164
|
+
var PROCESS_WIDE_METHODS = /* @__PURE__ */ new Set(["bind", "singleton", "extend"]);
|
|
3082
3165
|
var scopedViews = /* @__PURE__ */ new WeakMap();
|
|
3083
3166
|
function viewFrom(scope, application) {
|
|
3084
3167
|
let view = scopedViews.get(scope);
|
|
@@ -3087,7 +3170,12 @@ function viewFrom(scope, application) {
|
|
|
3087
3170
|
get(target, property) {
|
|
3088
3171
|
const source = SCOPE_METHODS.has(property) ? scope : target;
|
|
3089
3172
|
const member = Reflect.get(source, property, source);
|
|
3090
|
-
|
|
3173
|
+
if (typeof member !== "function") return member;
|
|
3174
|
+
if (!PROCESS_WIDE_METHODS.has(property)) return member.bind(source);
|
|
3175
|
+
return (...args) => {
|
|
3176
|
+
warnProcessWide(`app().${String(property)}()`, "app().instance() binds for this request");
|
|
3177
|
+
return member.apply(source, args);
|
|
3178
|
+
};
|
|
3091
3179
|
}
|
|
3092
3180
|
});
|
|
3093
3181
|
scopedViews.set(scope, view);
|
|
@@ -3124,6 +3212,19 @@ async function retry(times, fn, sleepMs = 0, when) {
|
|
|
3124
3212
|
}
|
|
3125
3213
|
}
|
|
3126
3214
|
}
|
|
3215
|
+
async function report(error) {
|
|
3216
|
+
const container = currentContainer();
|
|
3217
|
+
if (container !== void 0 && container.bound(ExceptionHandler)) await container.make(ExceptionHandler).report(error);
|
|
3218
|
+
else console.error(error);
|
|
3219
|
+
}
|
|
3220
|
+
async function rescue(callback, rescue2, shouldReport = true) {
|
|
3221
|
+
try {
|
|
3222
|
+
return await callback();
|
|
3223
|
+
} catch (error) {
|
|
3224
|
+
if (typeof shouldReport === "function" ? shouldReport(error) : shouldReport) await report(error);
|
|
3225
|
+
return typeof rescue2 === "function" ? await rescue2(error) : rescue2;
|
|
3226
|
+
}
|
|
3227
|
+
}
|
|
3127
3228
|
var LINES = {
|
|
3128
3229
|
"auth.failed": "These credentials do not match our records.",
|
|
3129
3230
|
"auth.password": "The provided password is incorrect.",
|
|
@@ -3268,7 +3369,10 @@ export {
|
|
|
3268
3369
|
Stringable,
|
|
3269
3370
|
Str,
|
|
3270
3371
|
Arr,
|
|
3372
|
+
serializeDate,
|
|
3373
|
+
ValidatedInput,
|
|
3271
3374
|
isPublicAsset,
|
|
3375
|
+
warnProcessWide,
|
|
3272
3376
|
ServiceProvider,
|
|
3273
3377
|
facade,
|
|
3274
3378
|
MissingPackageError,
|
|
@@ -3280,6 +3384,8 @@ export {
|
|
|
3280
3384
|
value,
|
|
3281
3385
|
tap,
|
|
3282
3386
|
retry,
|
|
3387
|
+
report,
|
|
3388
|
+
rescue,
|
|
3283
3389
|
__,
|
|
3284
3390
|
fileType_exports
|
|
3285
3391
|
};
|
|
@@ -3303,4 +3409,4 @@ export {
|
|
|
3303
3409
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
3304
3410
|
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
3305
3411
|
*/
|
|
3306
|
-
//# sourceMappingURL=chunk-
|
|
3412
|
+
//# sourceMappingURL=chunk-YNDMTTWL.js.map
|