@akbarsafari00/bonyan-types 5.52.1-fa.4
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/LICENSE +37 -0
- package/README.md +9 -0
- package/dist/core/api.d.ts +3 -0
- package/dist/core/api.d.ts.map +1 -0
- package/dist/core/commands/index.d.ts +6 -0
- package/dist/core/commands/index.d.ts.map +1 -0
- package/dist/core/config/admin.d.ts +156 -0
- package/dist/core/config/admin.d.ts.map +1 -0
- package/dist/core/config/api.d.ts +38 -0
- package/dist/core/config/api.d.ts.map +1 -0
- package/dist/core/config/database.d.ts +78 -0
- package/dist/core/config/database.d.ts.map +1 -0
- package/dist/core/config/features.d.ts +14 -0
- package/dist/core/config/features.d.ts.map +1 -0
- package/dist/core/config/index.d.ts +11 -0
- package/dist/core/config/index.d.ts.map +1 -0
- package/dist/core/config/middlewares.d.ts +3 -0
- package/dist/core/config/middlewares.d.ts.map +1 -0
- package/dist/core/config/openapi.d.ts +35 -0
- package/dist/core/config/openapi.d.ts.map +1 -0
- package/dist/core/config/plugin.d.ts +8 -0
- package/dist/core/config/plugin.d.ts.map +1 -0
- package/dist/core/config/server.d.ts +102 -0
- package/dist/core/config/server.d.ts.map +1 -0
- package/dist/core/config/shared.d.ts +8 -0
- package/dist/core/config/shared.d.ts.map +1 -0
- package/dist/core/config/typescript.d.ts +10 -0
- package/dist/core/config/typescript.d.ts.map +1 -0
- package/dist/core/container.d.ts +5 -0
- package/dist/core/container.d.ts.map +1 -0
- package/dist/core/controller.d.ts +7 -0
- package/dist/core/controller.d.ts.map +1 -0
- package/dist/core/core-api/controller.d.ts +47 -0
- package/dist/core/core-api/controller.d.ts.map +1 -0
- package/dist/core/core-api/index.d.ts +4 -0
- package/dist/core/core-api/index.d.ts.map +1 -0
- package/dist/core/core-api/router.d.ts +64 -0
- package/dist/core/core-api/router.d.ts.map +1 -0
- package/dist/core/core-api/service.d.ts +69 -0
- package/dist/core/core-api/service.d.ts.map +1 -0
- package/dist/core/index.d.ts +15 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/middleware.d.ts +15 -0
- package/dist/core/middleware.d.ts.map +1 -0
- package/dist/core/module.d.ts +26 -0
- package/dist/core/module.d.ts.map +1 -0
- package/dist/core/plugin.d.ts +6 -0
- package/dist/core/plugin.d.ts.map +1 -0
- package/dist/core/policy.d.ts +15 -0
- package/dist/core/policy.d.ts.map +1 -0
- package/dist/core/route.d.ts +54 -0
- package/dist/core/route.d.ts.map +1 -0
- package/dist/core/router.d.ts +15 -0
- package/dist/core/router.d.ts.map +1 -0
- package/dist/core/service.d.ts +4 -0
- package/dist/core/service.d.ts.map +1 -0
- package/dist/core/strapi.d.ts +162 -0
- package/dist/core/strapi.d.ts.map +1 -0
- package/dist/data/component.d.ts +21 -0
- package/dist/data/component.d.ts.map +1 -0
- package/dist/data/constants.d.ts +5 -0
- package/dist/data/constants.d.ts.map +1 -0
- package/dist/data/content-type.d.ts +26 -0
- package/dist/data/content-type.d.ts.map +1 -0
- package/dist/data/entity.d.ts +15 -0
- package/dist/data/entity.d.ts.map +1 -0
- package/dist/data/index.d.ts +5 -0
- package/dist/data/index.d.ts.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/dist/internal/index.d.ts +13 -0
- package/dist/internal/index.d.ts.map +1 -0
- package/dist/internal/namespace.d.ts +78 -0
- package/dist/internal/namespace.d.ts.map +1 -0
- package/dist/internal/registry.d.ts +8 -0
- package/dist/internal/registry.d.ts.map +1 -0
- package/dist/internal/uid.d.ts +116 -0
- package/dist/internal/uid.d.ts.map +1 -0
- package/dist/modules/ai.d.ts +34 -0
- package/dist/modules/ai.d.ts.map +1 -0
- package/dist/modules/audit-logs.d.ts +6 -0
- package/dist/modules/audit-logs.d.ts.map +1 -0
- package/dist/modules/auth.d.ts +25 -0
- package/dist/modules/auth.d.ts.map +1 -0
- package/dist/modules/content-api.d.ts +92 -0
- package/dist/modules/content-api.d.ts.map +1 -0
- package/dist/modules/core-store.d.ts +28 -0
- package/dist/modules/core-store.d.ts.map +1 -0
- package/dist/modules/cron.d.ts +27 -0
- package/dist/modules/cron.d.ts.map +1 -0
- package/dist/modules/custom-fields.d.ts +25 -0
- package/dist/modules/custom-fields.d.ts.map +1 -0
- package/dist/modules/documents/component-extension.d.ts +73 -0
- package/dist/modules/documents/component-extension.d.ts.map +1 -0
- package/dist/modules/documents/draft-and-publish.d.ts +12 -0
- package/dist/modules/documents/draft-and-publish.d.ts.map +1 -0
- package/dist/modules/documents/index.d.ts +27 -0
- package/dist/modules/documents/index.d.ts.map +1 -0
- package/dist/modules/documents/middleware.d.ts +14 -0
- package/dist/modules/documents/middleware.d.ts.map +1 -0
- package/dist/modules/documents/params/attributes/id.d.ts +4 -0
- package/dist/modules/documents/params/attributes/id.d.ts.map +1 -0
- package/dist/modules/documents/params/attributes/index.d.ts +79 -0
- package/dist/modules/documents/params/attributes/index.d.ts.map +1 -0
- package/dist/modules/documents/params/attributes/relations.d.ts +40 -0
- package/dist/modules/documents/params/attributes/relations.d.ts.map +1 -0
- package/dist/modules/documents/params/data.d.ts +67 -0
- package/dist/modules/documents/params/data.d.ts.map +1 -0
- package/dist/modules/documents/params/document-engine.d.ts +34 -0
- package/dist/modules/documents/params/document-engine.d.ts.map +1 -0
- package/dist/modules/documents/params/fields.d.ts +61 -0
- package/dist/modules/documents/params/fields.d.ts.map +1 -0
- package/dist/modules/documents/params/filters/index.d.ts +61 -0
- package/dist/modules/documents/params/filters/index.d.ts.map +1 -0
- package/dist/modules/documents/params/filters/operators.d.ts +9 -0
- package/dist/modules/documents/params/filters/operators.d.ts.map +1 -0
- package/dist/modules/documents/params/index.d.ts +162 -0
- package/dist/modules/documents/params/index.d.ts.map +1 -0
- package/dist/modules/documents/params/locale.d.ts +4 -0
- package/dist/modules/documents/params/locale.d.ts.map +1 -0
- package/dist/modules/documents/params/pagination.d.ts +11 -0
- package/dist/modules/documents/params/pagination.d.ts.map +1 -0
- package/dist/modules/documents/params/populate.d.ts +86 -0
- package/dist/modules/documents/params/populate.d.ts.map +1 -0
- package/dist/modules/documents/params/search.d.ts +2 -0
- package/dist/modules/documents/params/search.d.ts.map +1 -0
- package/dist/modules/documents/params/sort.d.ts +87 -0
- package/dist/modules/documents/params/sort.d.ts.map +1 -0
- package/dist/modules/documents/params/status.d.ts +12 -0
- package/dist/modules/documents/params/status.d.ts.map +1 -0
- package/dist/modules/documents/plugin.d.ts +11 -0
- package/dist/modules/documents/plugin.d.ts.map +1 -0
- package/dist/modules/documents/result/document-engine.d.ts +34 -0
- package/dist/modules/documents/result/document-engine.d.ts.map +1 -0
- package/dist/modules/documents/result/index.d.ts +93 -0
- package/dist/modules/documents/result/index.d.ts.map +1 -0
- package/dist/modules/documents/service-instance.d.ts +96 -0
- package/dist/modules/documents/service-instance.d.ts.map +1 -0
- package/dist/modules/entity-service/index.d.ts +87 -0
- package/dist/modules/entity-service/index.d.ts.map +1 -0
- package/dist/modules/entity-service/params/attributes/id.d.ts +3 -0
- package/dist/modules/entity-service/params/attributes/id.d.ts.map +1 -0
- package/dist/modules/entity-service/params/attributes/index.d.ts +71 -0
- package/dist/modules/entity-service/params/attributes/index.d.ts.map +1 -0
- package/dist/modules/entity-service/params/attributes/literals.d.ts +8 -0
- package/dist/modules/entity-service/params/attributes/literals.d.ts.map +1 -0
- package/dist/modules/entity-service/params/attributes/relation.d.ts +40 -0
- package/dist/modules/entity-service/params/attributes/relation.d.ts.map +1 -0
- package/dist/modules/entity-service/params/attributes/utils.d.ts +9 -0
- package/dist/modules/entity-service/params/attributes/utils.d.ts.map +1 -0
- package/dist/modules/entity-service/params/data.d.ts +52 -0
- package/dist/modules/entity-service/params/data.d.ts.map +1 -0
- package/dist/modules/entity-service/params/fields.d.ts +61 -0
- package/dist/modules/entity-service/params/fields.d.ts.map +1 -0
- package/dist/modules/entity-service/params/filters/index.d.ts +96 -0
- package/dist/modules/entity-service/params/filters/index.d.ts.map +1 -0
- package/dist/modules/entity-service/params/filters/operators.d.ts +9 -0
- package/dist/modules/entity-service/params/filters/operators.d.ts.map +1 -0
- package/dist/modules/entity-service/params/index.d.ts +123 -0
- package/dist/modules/entity-service/params/index.d.ts.map +1 -0
- package/dist/modules/entity-service/params/pagination.d.ts +10 -0
- package/dist/modules/entity-service/params/pagination.d.ts.map +1 -0
- package/dist/modules/entity-service/params/populate.d.ts +69 -0
- package/dist/modules/entity-service/params/populate.d.ts.map +1 -0
- package/dist/modules/entity-service/params/search.d.ts +2 -0
- package/dist/modules/entity-service/params/search.d.ts.map +1 -0
- package/dist/modules/entity-service/params/sort.d.ts +95 -0
- package/dist/modules/entity-service/params/sort.d.ts.map +1 -0
- package/dist/modules/entity-service/plugin.d.ts +11 -0
- package/dist/modules/entity-service/plugin.d.ts.map +1 -0
- package/dist/modules/entity-service/result.d.ts +78 -0
- package/dist/modules/entity-service/result.d.ts.map +1 -0
- package/dist/modules/entity-validator.d.ts +21 -0
- package/dist/modules/entity-validator.d.ts.map +1 -0
- package/dist/modules/event-hub.d.ts +16 -0
- package/dist/modules/event-hub.d.ts.map +1 -0
- package/dist/modules/features.d.ts +12 -0
- package/dist/modules/features.d.ts.map +1 -0
- package/dist/modules/fetch.d.ts +11 -0
- package/dist/modules/fetch.d.ts.map +1 -0
- package/dist/modules/index.d.ts +24 -0
- package/dist/modules/index.d.ts.map +1 -0
- package/dist/modules/mcp.d.ts +216 -0
- package/dist/modules/mcp.d.ts.map +1 -0
- package/dist/modules/metrics.d.ts +8 -0
- package/dist/modules/metrics.d.ts.map +1 -0
- package/dist/modules/permissions.d.ts +14 -0
- package/dist/modules/permissions.d.ts.map +1 -0
- package/dist/modules/request-context.d.ts +6 -0
- package/dist/modules/request-context.d.ts.map +1 -0
- package/dist/modules/sanitizers.d.ts +8 -0
- package/dist/modules/sanitizers.d.ts.map +1 -0
- package/dist/modules/server.d.ts +29 -0
- package/dist/modules/server.d.ts.map +1 -0
- package/dist/modules/session-manager.d.ts +70 -0
- package/dist/modules/session-manager.d.ts.map +1 -0
- package/dist/modules/validators.d.ts +8 -0
- package/dist/modules/validators.d.ts.map +1 -0
- package/dist/modules/webhook-runner.d.ts +19 -0
- package/dist/modules/webhook-runner.d.ts.map +1 -0
- package/dist/modules/webhook-store.d.ts +21 -0
- package/dist/modules/webhook-store.d.ts.map +1 -0
- package/dist/plugin/config/index.d.ts +3 -0
- package/dist/plugin/config/index.d.ts.map +1 -0
- package/dist/plugin/config/strapi-admin/index.d.ts +8 -0
- package/dist/plugin/config/strapi-admin/index.d.ts.map +1 -0
- package/dist/plugin/config/strapi-server/config.d.ts +8 -0
- package/dist/plugin/config/strapi-server/config.d.ts.map +1 -0
- package/dist/plugin/config/strapi-server/content-types.d.ts +11 -0
- package/dist/plugin/config/strapi-server/content-types.d.ts.map +1 -0
- package/dist/plugin/config/strapi-server/controllers.d.ts +8 -0
- package/dist/plugin/config/strapi-server/controllers.d.ts.map +1 -0
- package/dist/plugin/config/strapi-server/index.d.ts +21 -0
- package/dist/plugin/config/strapi-server/index.d.ts.map +1 -0
- package/dist/plugin/config/strapi-server/lifecycle.d.ts +8 -0
- package/dist/plugin/config/strapi-server/lifecycle.d.ts.map +1 -0
- package/dist/plugin/config/strapi-server/routes.d.ts +11 -0
- package/dist/plugin/config/strapi-server/routes.d.ts.map +1 -0
- package/dist/plugin/index.d.ts +40 -0
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/public/index.d.ts +6 -0
- package/dist/public/index.d.ts.map +1 -0
- package/dist/public/registries.d.ts +68 -0
- package/dist/public/registries.d.ts.map +1 -0
- package/dist/public/shared.d.ts +61 -0
- package/dist/public/shared.d.ts.map +1 -0
- package/dist/schema/attribute/base.d.ts +92 -0
- package/dist/schema/attribute/base.d.ts.map +1 -0
- package/dist/schema/attribute/common.d.ts +29 -0
- package/dist/schema/attribute/common.d.ts.map +1 -0
- package/dist/schema/attribute/constants.d.ts +12 -0
- package/dist/schema/attribute/constants.d.ts.map +1 -0
- package/dist/schema/attribute/definitions/biginteger.d.ts +19 -0
- package/dist/schema/attribute/definitions/biginteger.d.ts.map +1 -0
- package/dist/schema/attribute/definitions/blocks.d.ts +80 -0
- package/dist/schema/attribute/definitions/blocks.d.ts.map +1 -0
- package/dist/schema/attribute/definitions/boolean.d.ts +19 -0
- package/dist/schema/attribute/definitions/boolean.d.ts.map +1 -0
- package/dist/schema/attribute/definitions/component.d.ts +25 -0
- package/dist/schema/attribute/definitions/component.d.ts.map +1 -0
- package/dist/schema/attribute/definitions/date-time.d.ts +18 -0
- package/dist/schema/attribute/definitions/date-time.d.ts.map +1 -0
- package/dist/schema/attribute/definitions/date.d.ts +18 -0
- package/dist/schema/attribute/definitions/date.d.ts.map +1 -0
- package/dist/schema/attribute/definitions/decimal.d.ts +19 -0
- package/dist/schema/attribute/definitions/decimal.d.ts.map +1 -0
- package/dist/schema/attribute/definitions/dynamic-zone.d.ts +25 -0
- package/dist/schema/attribute/definitions/dynamic-zone.d.ts.map +1 -0
- package/dist/schema/attribute/definitions/email.d.ts +19 -0
- package/dist/schema/attribute/definitions/email.d.ts.map +1 -0
- package/dist/schema/attribute/definitions/enumeration.d.ts +22 -0
- package/dist/schema/attribute/definitions/enumeration.d.ts.map +1 -0
- package/dist/schema/attribute/definitions/float.d.ts +19 -0
- package/dist/schema/attribute/definitions/float.d.ts.map +1 -0
- package/dist/schema/attribute/definitions/index.d.ts +23 -0
- package/dist/schema/attribute/definitions/index.d.ts.map +1 -0
- package/dist/schema/attribute/definitions/integer.d.ts +19 -0
- package/dist/schema/attribute/definitions/integer.d.ts.map +1 -0
- package/dist/schema/attribute/definitions/json.d.ts +17 -0
- package/dist/schema/attribute/definitions/json.d.ts.map +1 -0
- package/dist/schema/attribute/definitions/media.d.ts +24 -0
- package/dist/schema/attribute/definitions/media.d.ts.map +1 -0
- package/dist/schema/attribute/definitions/password.d.ts +18 -0
- package/dist/schema/attribute/definitions/password.d.ts.map +1 -0
- package/dist/schema/attribute/definitions/relation.d.ts +167 -0
- package/dist/schema/attribute/definitions/relation.d.ts.map +1 -0
- package/dist/schema/attribute/definitions/richtext.d.ts +18 -0
- package/dist/schema/attribute/definitions/richtext.d.ts.map +1 -0
- package/dist/schema/attribute/definitions/string.d.ts +28 -0
- package/dist/schema/attribute/definitions/string.d.ts.map +1 -0
- package/dist/schema/attribute/definitions/text.d.ts +23 -0
- package/dist/schema/attribute/definitions/text.d.ts.map +1 -0
- package/dist/schema/attribute/definitions/time.d.ts +18 -0
- package/dist/schema/attribute/definitions/time.d.ts.map +1 -0
- package/dist/schema/attribute/definitions/timestamp.d.ts +18 -0
- package/dist/schema/attribute/definitions/timestamp.d.ts.map +1 -0
- package/dist/schema/attribute/definitions/uid.d.ts +31 -0
- package/dist/schema/attribute/definitions/uid.d.ts.map +1 -0
- package/dist/schema/attribute/index.d.ts +7 -0
- package/dist/schema/attribute/index.d.ts.map +1 -0
- package/dist/schema/attribute/options.d.ts +221 -0
- package/dist/schema/attribute/options.d.ts.map +1 -0
- package/dist/schema/attribute/utils.d.ts +101 -0
- package/dist/schema/attribute/utils.d.ts.map +1 -0
- package/dist/schema/index.d.ts +144 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/struct/index.d.ts +3 -0
- package/dist/struct/index.d.ts.map +1 -0
- package/dist/struct/schema-definition.d.ts +10 -0
- package/dist/struct/schema-definition.d.ts.map +1 -0
- package/dist/struct/schema.d.ts +286 -0
- package/dist/struct/schema.d.ts.map +1 -0
- package/dist/uid/index.d.ts +168 -0
- package/dist/uid/index.d.ts.map +1 -0
- package/dist/utils/array.d.ts +80 -0
- package/dist/utils/array.d.ts.map +1 -0
- package/dist/utils/constants.d.ts +67 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/expression.d.ts +490 -0
- package/dist/utils/expression.d.ts.map +1 -0
- package/dist/utils/function.d.ts +21 -0
- package/dist/utils/function.d.ts.map +1 -0
- package/dist/utils/guard.d.ts +90 -0
- package/dist/utils/guard.d.ts.map +1 -0
- package/dist/utils/index.d.ts +236 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/json.d.ts +119 -0
- package/dist/utils/json.d.ts.map +1 -0
- package/dist/utils/object.d.ts +180 -0
- package/dist/utils/object.d.ts.map +1 -0
- package/dist/utils/string.d.ts +190 -0
- package/dist/utils/string.d.ts.map +1 -0
- package/dist/utils/tuple.d.ts +19 -0
- package/dist/utils/tuple.d.ts.map +1 -0
- package/package.json +68 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import type { Extends } from './expression';
|
|
2
|
+
/**
|
|
3
|
+
* Alias for any literal type (useful for template string parameters)
|
|
4
|
+
*
|
|
5
|
+
* @see {@link Split}
|
|
6
|
+
* @see {@link Suffix}
|
|
7
|
+
* @see {@link Prefix}
|
|
8
|
+
* @see {@link StartsWith}
|
|
9
|
+
* @see {@link EndsWith}
|
|
10
|
+
*/
|
|
11
|
+
export type Literal = string | number | bigint | boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Ensures that a string is not empty.
|
|
14
|
+
*
|
|
15
|
+
* @template T - The type that extends a string.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // T is assigned a string type
|
|
19
|
+
* type A = NonEmpty<string>;
|
|
20
|
+
* // A can be any string except the empty string
|
|
21
|
+
* let a: A = "hello"; // Valid
|
|
22
|
+
* a = ""; // Error: Type '""' is not assignable to type 'NonEmpty<string>'
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* // T is assigned a string literal type
|
|
26
|
+
* type B = NonEmpty<"hello">;
|
|
27
|
+
* // B can only be "hello"
|
|
28
|
+
* let b: B = "hello"; // Valid
|
|
29
|
+
* b = ""; // Error: Type '""' is not assignable to type 'NonEmpty<"hello">'
|
|
30
|
+
*/
|
|
31
|
+
export type NonEmpty<T extends string> = T extends '' ? never : T;
|
|
32
|
+
/**
|
|
33
|
+
* Splits a given string ({@link TValue}) around occurrences of a given separator ({@link TSeparator}).
|
|
34
|
+
*
|
|
35
|
+
* The resulting type is an array where each item is a part of the original string that falls between two instances of the separator.
|
|
36
|
+
*
|
|
37
|
+
* If the string does not contain the separator, the array will contain just the original string.
|
|
38
|
+
*
|
|
39
|
+
* If the string is empty, the result is an empty array.
|
|
40
|
+
*
|
|
41
|
+
* @template TValue - The string to split. Must extend `string`.
|
|
42
|
+
* @template TSeparator - The character(s) used to determine in which locations the string should be split. Must be a `string`.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
*
|
|
46
|
+
* ```typescript
|
|
47
|
+
* type Example = Split<'a.b.c.d', '.'>; // Output will be: ['a', 'b', 'c', 'd']
|
|
48
|
+
* ```
|
|
49
|
+
* In the above example, the string 'a.b.c.d' is split around occurrences of the '.' separator.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
*
|
|
53
|
+
* ```typescript
|
|
54
|
+
* type ExampleUnion = Split<'a.b-c', '.' | '-'>; // Output will be: ['a', 'b-c'] | ['a.b', 'c']
|
|
55
|
+
* ```
|
|
56
|
+
* The split operation will distribute the union members and create two possible return type for the union
|
|
57
|
+
*/
|
|
58
|
+
export type Split<TValue extends string, TSeparator extends string> = {
|
|
59
|
+
[TSep in TSeparator]: TValue extends `${infer TLeft}${TSep}${infer TRight}` ? [TLeft, ...Split<TRight, TSep>] : TValue extends '' ? [] : [TValue];
|
|
60
|
+
}[TSeparator];
|
|
61
|
+
/**
|
|
62
|
+
* The `Suffix` type appends a literal suffix ({@link TSuffix}) to the end of a provided string ({@link TValue}).
|
|
63
|
+
*
|
|
64
|
+
* @template TValue - The string to add the suffix to.
|
|
65
|
+
* @template TSuffix - It extends the {@link Literal} type, and represents the suffix to append.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* // A type that appends '.com' to a string
|
|
70
|
+
* type DomainName = Suffix<string, '.com'>;
|
|
71
|
+
* const myComDomain: DomainName = 'example.com'; // This is valid
|
|
72
|
+
* const myNetDomain: DomainName = 'example.net'; // This is not valid
|
|
73
|
+
*
|
|
74
|
+
* // A variant using `number` as literal
|
|
75
|
+
* type SuffixedNumber = Suffix<string, 1>;
|
|
76
|
+
* const mySuffixedNumber: SuffixedNumber = 'example1'; // Also valid
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
export type Suffix<TValue extends string, TSuffix extends Literal> = `${TValue}${TSuffix}`;
|
|
80
|
+
/**
|
|
81
|
+
* Prepend a literal prefix ({@link TPrefix}) to the start of a provided string ({@link TValue}).
|
|
82
|
+
*
|
|
83
|
+
* @template TValue - The string to add the prefix to.
|
|
84
|
+
* @template TPrefix - It extends the {@link Literal} type, and represents the prefix to prepend.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```typescript
|
|
88
|
+
* // A type that prepends 'Hello ' to a string
|
|
89
|
+
* type Greeting = Suffix<string, 'Hello '>;
|
|
90
|
+
* const greeting: Greeting = 'Hello Bob'; // This is valid
|
|
91
|
+
* const farewell: Greeting = 'Bye Bob'; // This is not valid
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
export type Prefix<TValue extends string, TPrefix extends Literal> = `${TPrefix}${TValue}`;
|
|
95
|
+
/**
|
|
96
|
+
* Creates an indexed object where every key is a string and every value is `T`
|
|
97
|
+
*
|
|
98
|
+
* @template T - Value type of the dictionary
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* // Dictionary where each key is a string and is bound to a number type value.
|
|
102
|
+
* const numDict: Dict<number> = {
|
|
103
|
+
* 'a': 1,
|
|
104
|
+
* 'b': 2,
|
|
105
|
+
* 'c': 3
|
|
106
|
+
* };
|
|
107
|
+
*/
|
|
108
|
+
export type Dict<T> = {
|
|
109
|
+
[key: string]: T;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Determines if a string, represented by {@link TValue}, ends with a specific literal ({@link TSuffix}).
|
|
113
|
+
*
|
|
114
|
+
* @template TValue - The string to check.
|
|
115
|
+
* @template TSuffix - A literal which may or may not be at the end of {@link TValue}.
|
|
116
|
+
*
|
|
117
|
+
* @remark
|
|
118
|
+
* To remember easily: `String.prototype.endsWith` method but at type level.
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```typescript
|
|
122
|
+
* type Result = EndsWith<"HelloWorld", "World">;
|
|
123
|
+
* // Output: Constants.True
|
|
124
|
+
* ```
|
|
125
|
+
*
|
|
126
|
+
* ```typescript
|
|
127
|
+
* type Result = EndsWith<"HelloWorld", "Hello">;
|
|
128
|
+
* // Output: Constants.False
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
131
|
+
export type EndsWith<TValue extends string, TSuffix extends Literal> = Extends<TValue, `${string}${TSuffix}`>;
|
|
132
|
+
/**
|
|
133
|
+
* Determines if a string, represented by {@link TValue}, starts with a specific literal ({@link TPrefix}).
|
|
134
|
+
*
|
|
135
|
+
* @template TValue - The string to check.
|
|
136
|
+
* @template TPrefix - A literal which may or may not be at the start of {@link TValue}.
|
|
137
|
+
*
|
|
138
|
+
* @remark
|
|
139
|
+
* To remember easily: `String.prototype.startsWith` method but at type level.
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```typescript
|
|
143
|
+
* type IsHelloWorld = StartsWith<"Hello World", "Hello">;
|
|
144
|
+
* // Output: Constants.True
|
|
145
|
+
* ```
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```typescript
|
|
149
|
+
* type NotHelloWorld = StartsWith<"World Hello", "Hello">;
|
|
150
|
+
* // Output: Constants.False
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
export type StartsWith<TValue extends string, TPrefix extends Literal> = Extends<TValue, `${TPrefix}${string}`>;
|
|
154
|
+
/**
|
|
155
|
+
* Combines a union of literal types with a more general type while preserving autocompletion.
|
|
156
|
+
*
|
|
157
|
+
* When using string literal unions, it maintains IDE suggestions for the literal values while
|
|
158
|
+
* still allowing any value of the base type.
|
|
159
|
+
*
|
|
160
|
+
* @template T - The literal type to suggest in autocompletion (for example, specific strings)
|
|
161
|
+
* @template U - The base type that T extends from (defaults to string)
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* // Define a type for specific HTTP methods while allowing custom one's
|
|
165
|
+
* type HttpMethod = LiteralUnion<'GET' | 'POST' | 'PUT' | 'DELETE'>;
|
|
166
|
+
*
|
|
167
|
+
* // These will show up in autocompletion
|
|
168
|
+
* const method1: HttpMethod = 'GET'; // ✓ Valid
|
|
169
|
+
* const method2: HttpMethod = 'POST'; // ✓ Valid
|
|
170
|
+
*
|
|
171
|
+
* // This is also valid since any string is allowed
|
|
172
|
+
* const method3: HttpMethod = 'PATCH'; // ✓ Valid
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* // Can be used with number literals too
|
|
176
|
+
* type CommonPorts = LiteralUnion<80 | 443 | 3000, number>;
|
|
177
|
+
*
|
|
178
|
+
* // Suggested in autocompletion
|
|
179
|
+
* const port1: CommonPorts = 80; // ✓ Valid
|
|
180
|
+
* const port2: CommonPorts = 443; // ✓ Valid
|
|
181
|
+
*
|
|
182
|
+
* // Any number is still accepted
|
|
183
|
+
* const port3: CommonPorts = 8080; // ✓ Valid
|
|
184
|
+
*
|
|
185
|
+
* @remark
|
|
186
|
+
* This type is particularly useful for API parameters where specific values should be suggested,
|
|
187
|
+
* but custom values shouldn't be restricted.
|
|
188
|
+
*/
|
|
189
|
+
export type LiteralUnion<T extends U, U = string> = T | (U & NonNullable<unknown>);
|
|
190
|
+
//# sourceMappingURL=string.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/utils/string.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAE5C;;;;;;;;GAQG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEzD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,EAAE,GAAG,KAAK,GAAG,CAAC,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,MAAM,KAAK,CAAC,MAAM,SAAS,MAAM,EAAE,UAAU,SAAS,MAAM,IAAI;KACnE,IAAI,IAAI,UAAU,GAAG,MAAM,SAAS,GAAG,MAAM,KAAK,GAAG,IAAI,GAAG,MAAM,MAAM,EAAE,GACvE,CAAC,KAAK,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,GAC/B,MAAM,SAAS,EAAE,GACf,EAAE,GACF,CAAC,MAAM,CAAC;CACf,CAAC,UAAU,CAAC,CAAC;AAEd;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,MAAM,CAAC,MAAM,SAAS,MAAM,EAAE,OAAO,SAAS,OAAO,IAAI,GAAG,MAAM,GAAG,OAAO,EAAE,CAAC;AAE3F;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,MAAM,CAAC,MAAM,SAAS,MAAM,EAAE,OAAO,SAAS,OAAO,IAAI,GAAG,OAAO,GAAG,MAAM,EAAE,CAAC;AAE3F;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,IAAI,CAAC,CAAC,IAAI;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,CAAA;CAAE,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,QAAQ,CAAC,MAAM,SAAS,MAAM,EAAE,OAAO,SAAS,OAAO,IAAI,OAAO,CAC5E,MAAM,EACN,GAAG,MAAM,GAAG,OAAO,EAAE,CACtB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,UAAU,CAAC,MAAM,SAAS,MAAM,EAAE,OAAO,SAAS,OAAO,IAAI,OAAO,CAC9E,MAAM,EACN,GAAG,OAAO,GAAG,MAAM,EAAE,CACtB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Literal } from './string';
|
|
2
|
+
/**
|
|
3
|
+
* Transforms a tuple ({@link TCollection}) into a concatenated string, interlaced with a designated separator character ({@link TSeparator}).
|
|
4
|
+
*
|
|
5
|
+
* @template TCollection - Represents the array of elements to be joined.
|
|
6
|
+
* @template TSeparator - Represents the separator character used to join the elements of {@link TCollection}.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* type R1 = Join<["John", "Doe", "Smith"], ",">; // type R1 = "John,Doe,Smith"
|
|
11
|
+
* type R2 = Join<[1, 2, 3, 4], "-">; // type R2 = "1-2-3-4"
|
|
12
|
+
* type R3 = Join<["Foo", "Bar", "Baz"], "," | "-">; // type R3 = "Foo,Bar,Baz" | "Foo-Bar-Baz"
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export type Join<TCollection extends unknown[], TSeparator extends Literal> = TCollection extends [
|
|
16
|
+
infer THead extends Literal,
|
|
17
|
+
...infer TTail
|
|
18
|
+
] ? TTail['length'] extends 0 ? THead : `${THead}${TSeparator}${Join<TTail, TSeparator>}` : never;
|
|
19
|
+
//# sourceMappingURL=tuple.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tuple.d.ts","sourceRoot":"","sources":["../../src/utils/tuple.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,IAAI,CAAC,WAAW,SAAS,OAAO,EAAE,EAAE,UAAU,SAAS,OAAO,IAAI,WAAW,SAAS;IAChG,MAAM,KAAK,SAAS,OAAO;IAC3B,GAAG,MAAM,KAAK;CACf,GACG,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,GACvB,KAAK,GACL,GAAG,KAAK,GAAG,UAAU,GAAG,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,EAAE,GACnD,KAAK,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@akbarsafari00/bonyan-types",
|
|
3
|
+
"version": "5.52.1-fa.4",
|
|
4
|
+
"description": "Shared typescript types for Bonyan internal use",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"strapi"
|
|
7
|
+
],
|
|
8
|
+
"homepage": "https://www.npmjs.com/package/@akbarsafari00/bonyan-types",
|
|
9
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
10
|
+
"author": "akbarsafari00",
|
|
11
|
+
"main": "./dist/index.js",
|
|
12
|
+
"source": "./src/index.ts",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"source": "./src/index.ts",
|
|
18
|
+
"import": "./dist/index.mjs",
|
|
19
|
+
"require": "./dist/index.js",
|
|
20
|
+
"default": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./package.json": "./package.json",
|
|
23
|
+
"./*": "./*"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist/"
|
|
27
|
+
],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "run -T npm-run-all clean --parallel build:code build:types",
|
|
30
|
+
"build:code": "run -T rollup -c",
|
|
31
|
+
"build:types": "run -T tsc -p tsconfig.build.json --emitDeclarationOnly",
|
|
32
|
+
"clean": "run -T rimraf ./dist",
|
|
33
|
+
"doc:ts": "typedoc",
|
|
34
|
+
"doc:ts:watch": "typedoc --watch",
|
|
35
|
+
"lint": "run -T eslint . --max-warnings=0",
|
|
36
|
+
"test:ts": "run -T tsc -p tsconfig.json",
|
|
37
|
+
"watch": "run -T tsc -p tsconfig.build.json -w"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@casl/ability": "6.7.5",
|
|
41
|
+
"@koa/cors": "5.0.0",
|
|
42
|
+
"@koa/router": "12.0.2",
|
|
43
|
+
"@modelcontextprotocol/sdk": "1.30.0",
|
|
44
|
+
"@strapi/database": "npm:@akbarsafari00/bonyan-database@5.52.1-fa.4",
|
|
45
|
+
"@strapi/logger": "5.52.1",
|
|
46
|
+
"@strapi/permissions": "5.52.1",
|
|
47
|
+
"@strapi/utils": "5.52.1",
|
|
48
|
+
"commander": "8.3.0",
|
|
49
|
+
"json-logic-js": "2.0.5",
|
|
50
|
+
"koa": "2.16.4",
|
|
51
|
+
"koa-body": "6.0.1",
|
|
52
|
+
"node-schedule": "2.1.1",
|
|
53
|
+
"typedoc": "0.28.19",
|
|
54
|
+
"typedoc-github-wiki-theme": "2.1.0",
|
|
55
|
+
"typedoc-plugin-markdown": "4.11.0",
|
|
56
|
+
"zod": "3.25.76"
|
|
57
|
+
},
|
|
58
|
+
"engines": {
|
|
59
|
+
"node": ">=20.0.0 <=26.x.x",
|
|
60
|
+
"npm": ">=6.0.0"
|
|
61
|
+
},
|
|
62
|
+
"private": false,
|
|
63
|
+
"optionalDependencies": {},
|
|
64
|
+
"publishConfig": {
|
|
65
|
+
"access": "public",
|
|
66
|
+
"registry": "https://registry.npmjs.org/"
|
|
67
|
+
}
|
|
68
|
+
}
|