@tailor-platform/sdk 1.14.0 → 1.14.2

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.
Files changed (44) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +19 -0
  3. package/dist/application-BznueWxG.mjs +4 -0
  4. package/dist/{application-DnWZVbDO.mjs → application-DhwHYQ3H.mjs} +95 -44
  5. package/dist/application-DhwHYQ3H.mjs.map +1 -0
  6. package/dist/cli/index.mjs +4 -4
  7. package/dist/cli/lib.d.mts +13 -49
  8. package/dist/cli/lib.mjs +4 -4
  9. package/dist/cli/skills.d.mts +2 -0
  10. package/dist/cli/skills.mjs +51 -0
  11. package/dist/cli/skills.mjs.map +1 -0
  12. package/dist/configure/index.d.mts +4 -4
  13. package/dist/configure/index.mjs +2 -2
  14. package/dist/configure/index.mjs.map +1 -1
  15. package/dist/index-YzESrtj0.d.mts +396 -0
  16. package/dist/{index-DMoFYBhB.d.mts → index-q3n7wQOs.d.mts} +13 -12
  17. package/dist/{jiti-DuCiUfMj.mjs → jiti-BrELlEYT.mjs} +2 -2
  18. package/dist/{jiti-DuCiUfMj.mjs.map → jiti-BrELlEYT.mjs.map} +1 -1
  19. package/dist/{job-zGAXCidt.mjs → job-XiwGyFJt.mjs} +1 -1
  20. package/dist/{job-zGAXCidt.mjs.map → job-XiwGyFJt.mjs.map} +1 -1
  21. package/dist/plugin/index.d.mts +16 -2
  22. package/dist/plugin/index.mjs +208 -1
  23. package/dist/plugin/index.mjs.map +1 -1
  24. package/dist/{schema-BmKdDzr1.mjs → schema-DRYB-nzA.mjs} +1 -1
  25. package/dist/{schema-BmKdDzr1.mjs.map → schema-DRYB-nzA.mjs.map} +1 -1
  26. package/dist/{src-QNTCsO6J.mjs → src-DMROgdcL.mjs} +2 -2
  27. package/dist/{src-QNTCsO6J.mjs.map → src-DMROgdcL.mjs.map} +1 -1
  28. package/dist/{index-Bw_huFr7.d.mts → types-DbvONSS-.d.mts} +576 -460
  29. package/dist/{types-r-ZratAg.mjs → types-b-ig8nW_.mjs} +1 -1
  30. package/dist/types-b-ig8nW_.mjs.map +1 -0
  31. package/dist/{update-BnKKm4aR.mjs → update-Dm8ERWHJ.mjs} +312 -151
  32. package/dist/update-Dm8ERWHJ.mjs.map +1 -0
  33. package/dist/utils/test/index.d.mts +3 -3
  34. package/dist/utils/test/index.mjs +1 -1
  35. package/docs/plugin/custom.md +105 -49
  36. package/docs/plugin/index.md +2 -2
  37. package/package.json +5 -3
  38. package/skills/tailor-sdk/SKILL.md +34 -0
  39. package/dist/application-DM4zTgXU.mjs +0 -4
  40. package/dist/application-DnWZVbDO.mjs.map +0 -1
  41. package/dist/env-4RO7szrH.d.mts +0 -66
  42. package/dist/types-r-ZratAg.mjs.map +0 -1
  43. package/dist/update-BnKKm4aR.mjs.map +0 -1
  44. /package/dist/{chunk-C3Kl5s5P.mjs → chunk-GMkBE123.mjs} +0 -0
@@ -1,66 +0,0 @@
1
- /// <reference path="./user-defined.d.ts" />
2
- //#region src/configure/types/user.d.ts
3
- interface AttributeMap {}
4
- interface AttributeList {
5
- __tuple?: [];
6
- }
7
- type InferredAttributeMap = keyof AttributeMap extends never ? Record<string, string | string[] | boolean | boolean[] | undefined> : AttributeMap;
8
- type InferredAttributeList = AttributeList["__tuple"] extends [] ? string[] : AttributeList["__tuple"];
9
- /** Represents a user in the Tailor platform. */
10
- type TailorUser = {
11
- /**
12
- * The ID of the user.
13
- * For unauthenticated users, this will be a nil UUID.
14
- */
15
- id: string;
16
- /**
17
- * The type of the user.
18
- * For unauthenticated users, this will be an empty string.
19
- */
20
- type: "user" | "machine_user" | "";
21
- /** The ID of the workspace the user belongs to. */
22
- workspaceId: string;
23
- /**
24
- * A map of the user's attributes.
25
- * For unauthenticated users, this will be null.
26
- */
27
- attributes: InferredAttributeMap | null;
28
- /**
29
- * A list of the user's attributes.
30
- * For unauthenticated users, this will be an empty array.
31
- */
32
- attributeList: InferredAttributeList;
33
- };
34
- /** Represents an unauthenticated user in the Tailor platform. */
35
- declare const unauthenticatedTailorUser: TailorUser;
36
- //#endregion
37
- //#region src/configure/types/actor.d.ts
38
- /** User type enum values from the Tailor Platform server. */
39
- type TailorActorType = "USER_TYPE_USER" | "USER_TYPE_MACHINE_USER" | "USER_TYPE_UNSPECIFIED";
40
- /** Represents an actor in event triggers. */
41
- type TailorActor = {
42
- /** The ID of the workspace the user belongs to. */
43
- workspaceId: string;
44
- /** The ID of the user. */
45
- userId: string;
46
- /**
47
- * A map of the user's attributes.
48
- * Maps from server's `attributeMap` field.
49
- */
50
- attributes: InferredAttributeMap | null;
51
- /**
52
- * A list of the user's attributes.
53
- * Maps from server's `attributes` field.
54
- */
55
- attributeList: InferredAttributeList;
56
- /** The type of the user. */
57
- userType: TailorActorType;
58
- };
59
- //#endregion
60
- //#region src/configure/types/env.d.ts
61
- interface Env {}
62
- /** Represents environment variables in the Tailor platform. */
63
- type TailorEnv = keyof Env extends never ? Record<string, string> : Env;
64
- //#endregion
65
- export { AttributeMap as a, unauthenticatedTailorUser as c, AttributeList as i, TailorEnv as n, InferredAttributeMap as o, TailorActor as r, TailorUser as s, Env as t };
66
- //# sourceMappingURL=env-4RO7szrH.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types-r-ZratAg.mjs","names":[],"sources":["../src/parser/service/tailordb/types.ts"],"sourcesContent":["import type { RelationType } from \"./relation\";\nimport type {\n DBFieldMetadataSchema,\n RawRelationConfigSchema,\n TailorDBTypeSchema,\n TailorDBServiceConfig as TailorDBServiceConfigType,\n TailorDBTypeSettingsSchema,\n} from \"./schema\";\nimport type {\n GqlOperations,\n GqlOperationsConfig,\n TailorTypeGqlPermission,\n TailorTypePermission,\n} from \"@/configure/services/tailordb\";\nimport type { ValueOperand } from \"@/parser/service/auth/types\";\nimport type { z } from \"zod\";\n\nexport type { RelationType } from \"./relation\";\nexport type { TypeSourceInfo } from \"./type-parser\";\n\n// ========================================\n// Source info type for TailorDB types\n// ========================================\n\n/**\n * Source information for a user-defined TailorDB type.\n */\nexport interface UserDefinedTypeSource {\n /** File path to import from */\n filePath: string;\n /** Export name in the source file */\n exportName: string;\n /** Not present for user-defined types */\n pluginId?: never;\n}\n\n/**\n * Source information for a plugin-generated TailorDB type.\n */\nexport interface PluginGeneratedTypeSource {\n /** Not present for plugin-generated types */\n filePath?: never;\n /** Export name of the generated type */\n exportName: string;\n /** Plugin ID that generated this type */\n pluginId: string;\n /** Plugin import path for code generators */\n pluginImportPath: string;\n /** Original type's file path */\n originalFilePath: string;\n /** Original type's export name */\n originalExportName: string;\n /** Generated type kind for getGeneratedType() API (e.g., \"request\", \"step\") */\n generatedTypeKind?: string;\n /** Plugin config used to generate this type */\n pluginConfig?: unknown;\n}\n\n/**\n * Source information for a TailorDB type.\n * Discriminated union: use `pluginId` to distinguish between user-defined and plugin-generated types.\n */\nexport type TypeSourceInfoEntry = UserDefinedTypeSource | PluginGeneratedTypeSource;\n\n/**\n * Type guard to check if source is plugin-generated\n * @param source - Type source info to check\n * @returns True if source is plugin-generated\n */\nexport function isPluginGeneratedType(\n source: TypeSourceInfoEntry,\n): source is PluginGeneratedTypeSource {\n return source.pluginId !== undefined;\n}\n\nexport type {\n TailorAnyDBField,\n TailorAnyDBType,\n TailorDBField,\n DBFieldMetadata,\n Hook,\n TailorTypePermission,\n TailorTypeGqlPermission,\n GqlOperationsConfig,\n GqlOperations,\n} from \"@/configure/services/tailordb\";\nexport type {\n TailorDBServiceConfigInput,\n TailorDBServiceConfig,\n TailorDBExternalConfig,\n TailorDBServiceInput,\n} from \"./schema\";\n\n/**\n * Parsed and normalized settings for TailorDB type.\n * gqlOperations is normalized from alias to object format.\n * @public\n */\nexport type TailorDBTypeParsedSettings = z.output<typeof TailorDBTypeSettingsSchema>;\n\n/**\n * Migration configuration for TailorDB\n * @public\n */\nexport type TailorDBMigrationConfig = NonNullable<TailorDBServiceConfigType[\"migration\"]>;\n\nexport type TailorDBTypeSchemaOutput = z.output<typeof TailorDBTypeSchema>;\n\nexport type DBFieldMetadataOutput = z.output<typeof DBFieldMetadataSchema>;\nexport type RawRelationConfigOutput = z.output<typeof RawRelationConfigSchema>;\n\nexport type TailorDBFieldOutput = {\n type: string;\n fields?: Record<string, TailorDBFieldOutput>;\n metadata: DBFieldMetadataOutput;\n rawRelation?: RawRelationConfigOutput;\n};\n\nexport interface Script {\n expr: string;\n}\n\nexport interface EnumValue {\n value: string;\n description?: string;\n}\n\ninterface OperatorValidateConfig {\n script: Script;\n errorMessage: string;\n}\n\ninterface OperatorFieldHook {\n create?: Script;\n update?: Script;\n}\n\n/**\n * Raw relation config stored in configure layer, processed in parser layer.\n * This is the serialized form of RelationConfig from schema.ts where\n * the TailorDBType reference is replaced with the type name string.\n */\nexport interface RawRelationConfig {\n type: RelationType;\n toward: {\n type: string;\n as?: string;\n key?: string;\n };\n backward?: string;\n}\n\nexport interface OperatorFieldConfig {\n type: string;\n required?: boolean;\n description?: string;\n allowedValues?: EnumValue[];\n array?: boolean;\n index?: boolean;\n unique?: boolean;\n vector?: boolean;\n foreignKey?: boolean;\n foreignKeyType?: string;\n foreignKeyField?: string;\n rawRelation?: RawRelationConfig;\n validate?: OperatorValidateConfig[];\n hooks?: OperatorFieldHook;\n serial?: {\n start: number;\n maxValue?: number;\n format?: string;\n };\n fields?: Record<string, OperatorFieldConfig>;\n}\n\ntype GqlPermissionAction = \"read\" | \"create\" | \"update\" | \"delete\" | \"aggregate\" | \"bulkUpsert\";\n\ntype StandardPermissionOperator = \"eq\" | \"ne\" | \"in\" | \"nin\";\n\ntype UserOperand = {\n user: string;\n};\n\ntype RecordOperand<Update extends boolean = false> = Update extends true\n ? { oldRecord: string } | { newRecord: string }\n : { record: string };\n\nexport type PermissionOperand<\n Level extends \"record\" | \"gql\" = \"record\" | \"gql\",\n Update extends boolean = boolean,\n> = UserOperand | ValueOperand | (Level extends \"record\" ? RecordOperand<Update> : never);\n\nexport type StandardPermissionCondition<\n Level extends \"record\" | \"gql\" = \"record\" | \"gql\",\n Update extends boolean = boolean,\n> = readonly [\n PermissionOperand<Level, Update>,\n StandardPermissionOperator,\n PermissionOperand<Level, Update>,\n];\n\nexport type StandardActionPermission<\n Level extends \"record\" | \"gql\" = \"record\" | \"gql\",\n Update extends boolean = boolean,\n> = {\n conditions: readonly StandardPermissionCondition<Level, Update>[];\n description?: string;\n permit: \"allow\" | \"deny\";\n};\n\nexport type StandardTailorTypePermission = {\n create: readonly StandardActionPermission<\"record\", false>[];\n read: readonly StandardActionPermission<\"record\", false>[];\n update: readonly StandardActionPermission<\"record\", true>[];\n delete: readonly StandardActionPermission<\"record\", false>[];\n};\n\nexport type StandardGqlPermissionPolicy = {\n conditions: readonly StandardPermissionCondition<\"gql\">[];\n actions: readonly [\"all\"] | readonly GqlPermissionAction[];\n permit: \"allow\" | \"deny\";\n description?: string;\n};\n\nexport type StandardTailorTypeGqlPermission = readonly StandardGqlPermissionPolicy[];\n\nexport interface Permissions {\n record?: StandardTailorTypePermission;\n gql?: StandardTailorTypeGqlPermission;\n}\n\nexport interface RawPermissions {\n // Raw permissions are user-provided\n // oxlint-disable-next-line no-explicit-any\n record?: TailorTypePermission<any, any>;\n // Raw permissions are user-provided\n // oxlint-disable-next-line no-explicit-any\n gql?: TailorTypeGqlPermission<any, any>;\n}\n\nexport interface TailorDBTypeMetadata {\n name: string;\n description?: string;\n settings?: {\n pluralForm?: string;\n aggregation?: boolean;\n bulkUpsert?: boolean;\n gqlOperations?: GqlOperationsConfig;\n };\n permissions: RawPermissions;\n files: Record<string, string>;\n indexes?: Record<\n string,\n {\n fields: string[];\n unique?: boolean;\n }\n >;\n}\n\n/**\n * Parsed and normalized TailorDB field information\n */\nexport interface ParsedField {\n name: string;\n config: OperatorFieldConfig;\n relation?: {\n targetType: string;\n forwardName: string;\n backwardName: string;\n key: string;\n unique: boolean;\n };\n}\n\n/**\n * Parsed and normalized TailorDB relationship information\n */\nexport interface ParsedRelationship {\n name: string;\n targetType: string;\n targetField: string;\n sourceField: string;\n isArray: boolean;\n description: string;\n}\n\n/**\n * Parsed and normalized TailorDB type information\n */\nexport interface TailorDBType {\n name: string;\n pluralForm: string;\n description?: string;\n fields: Record<string, ParsedField>;\n forwardRelationships: Record<string, ParsedRelationship>;\n backwardRelationships: Record<string, ParsedRelationship>;\n settings: TailorDBTypeParsedSettings;\n permissions: Permissions;\n indexes?: TailorDBTypeMetadata[\"indexes\"];\n files?: TailorDBTypeMetadata[\"files\"];\n}\n"],"mappings":";;;;;;AAqEA,SAAgB,sBACd,QACqC;AACrC,QAAO,OAAO,aAAa"}