@tailor-platform/sdk 0.8.5 → 0.9.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/CHANGELOG.md CHANGED
@@ -1,5 +1,46 @@
1
1
  # @tailor-platform/sdk
2
2
 
3
+ ## 0.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#16](https://github.com/tailor-platform/sdk/pull/16) [`7bb9d3a`](https://github.com/tailor-platform/sdk/commit/7bb9d3ae0b1568075867ddf2c2027a636037ee09) Thanks [@remiposo](https://github.com/remiposo)! - Set labels for resource management
8
+
9
+ Previously, apply operations targeted all resources in the workspace, so any resources not listed in the config were deleted during apply. This made it practically impossible to create resources managed by Terraform or other SDK applications in the same workspace.
10
+
11
+ With this change, resources generated by the SDK are now automatically labeled. By only targeting resources with appropriate labels for deletion, coexistence with resources managed elsewhere is now possible. While this label is currently internal, it should become visible in the console in the future.
12
+
13
+ **Breaking Changes:**
14
+
15
+ Existing applications are not labeled, so the following warning will appear when you apply for the first time after updating.
16
+ Please confirm or pass the `--yes` flag.
17
+
18
+ ```
19
+ WARN Unmanaged resources detected:
20
+
21
+ Resources:
22
+ • TailorDB service "my-db"
23
+ • Auth service "my-auth"
24
+ ...
25
+
26
+ These resources are not managed by any application.
27
+
28
+ ❯ Add these resources to "my-app"?
29
+ ○ Yes / ● No
30
+ ```
31
+
32
+ ### Patch Changes
33
+
34
+ - [#16](https://github.com/tailor-platform/sdk/pull/16) [`7bb9d3a`](https://github.com/tailor-platform/sdk/commit/7bb9d3ae0b1568075867ddf2c2027a636037ee09) Thanks [@remiposo](https://github.com/remiposo)! - Load resolver and executor files only once
35
+
36
+ By reusing the results when files have already been loaded, file loading logs are no longer displayed multiple times during apply.
37
+
38
+ ## 0.8.6
39
+
40
+ ### Patch Changes
41
+
42
+ - [#24](https://github.com/tailor-platform/sdk/pull/24) [`ffa71fe`](https://github.com/tailor-platform/sdk/commit/ffa71feba26b36be84292dbaaadc0d2a37dc6b96) Thanks [@riku99](https://github.com/riku99)! - Fix generator bugs with multiple TailorDB namespaces and refactor to object-based data passing
43
+
3
44
  ## 0.8.5
4
45
 
5
46
  ### Patch Changes
@@ -1,22 +1,12 @@
1
1
  /// <reference path="./../plugin-generated.d.ts" />
2
2
 
3
- import { AppConfig, CodeGeneratorBase, Executor, Generator, Resolver, TailorDBTypeConfig } from "../types-BP7g8Bh3.mjs";
3
+ import { AppConfig, CodeGeneratorBase, Executor, Generator, Resolver, TailorDBTypeConfig } from "../types-CPcmGK_X.mjs";
4
4
  import "citty";
5
5
  import "zod";
6
6
  import "@bufbuild/protobuf/wkt";
7
7
  import "@bufbuild/protobuf/codegenv2";
8
8
  import "@bufbuild/protobuf";
9
9
 
10
- //#region src/cli/apply/index.d.ts
11
- interface ApplyOptions {
12
- workspaceId?: string;
13
- profile?: string;
14
- configPath?: string;
15
- dryRun?: boolean;
16
- buildOnly?: boolean;
17
- }
18
- declare function apply(options?: ApplyOptions): Promise<void>;
19
- //#endregion
20
10
  //#region src/parser/service/tailordb/types.d.ts
21
11
  /**
22
12
  * Parsed and normalized TailorDB field information
@@ -59,6 +49,17 @@ interface ParsedTailorDBType {
59
49
  files?: TailorDBTypeConfig["schema"]["files"];
60
50
  }
61
51
  //#endregion
52
+ //#region src/cli/apply/index.d.ts
53
+ interface ApplyOptions {
54
+ workspaceId?: string;
55
+ profile?: string;
56
+ configPath?: string;
57
+ dryRun?: boolean;
58
+ yes?: boolean;
59
+ buildOnly?: boolean;
60
+ }
61
+ declare function apply(options?: ApplyOptions): Promise<void>;
62
+ //#endregion
62
63
  //#region src/cli/generator/types.d.ts
63
64
  interface GeneratedFile {
64
65
  path: string;
package/dist/cli/api.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { apply, generate, generateUserTypes, loadConfig, machineUserList, machineUserToken, show, workspaceCreate, workspaceDelete, workspaceList } from "../token-B9zkxSMS.mjs";
1
+ import { apply, generate, generateUserTypes, loadConfig, machineUserList, machineUserToken, show, workspaceCreate, workspaceDelete, workspaceList } from "../token-DwKmpi9i.mjs";
2
2
  import "../auth-Di3vQUrT.mjs";
3
3
 
4
4
  export { apply, generate, generateUserTypes, loadConfig, machineUserList, machineUserToken, show, workspaceCreate, workspaceDelete, workspaceList };
@@ -1,17 +1,16 @@
1
1
  #!/usr/bin/env node
2
- import { PATScope, applyCommand, commonArgs, createCommand, deleteCommand, fetchAll, fetchLatestToken, formatArgs, generateCommand, initOperatorClient, listCommand as listCommand$4, listCommand$1 as listCommand, loadAccessToken, loadConfig, loadConfigPath, loadWorkspaceId, parseFormat, printWithFormat, readPlatformConfig, showCommand, tokenCommand, userAgent, withCommonArgs, writePlatformConfig } from "../token-B9zkxSMS.mjs";
2
+ import { PATScope, applyCommand, commonArgs, createCommand, deleteCommand, fetchAll, fetchLatestToken, formatArgs, generateCommand, initOperatorClient, listCommand as listCommand$4, listCommand$1 as listCommand, loadAccessToken, loadConfig, loadConfigPath, loadWorkspaceId, parseFormat, printWithFormat, readPackageJson, readPlatformConfig, showCommand, tokenCommand, userAgent, withCommonArgs, writePlatformConfig } from "../token-DwKmpi9i.mjs";
3
3
  import "../auth-Di3vQUrT.mjs";
4
4
  import { register } from "node:module";
5
5
  import { defineCommand, runCommand, runMain } from "citty";
6
6
  import { z } from "zod";
7
- import { readPackageJSON } from "pkg-types";
8
7
  import ml from "multiline-ts";
9
8
  import { consola } from "consola";
9
+ import chalk from "chalk";
10
10
  import { spawnSync } from "node:child_process";
11
11
  import * as crypto from "node:crypto";
12
12
  import * as http from "node:http";
13
13
  import open from "open";
14
- import chalk from "chalk";
15
14
 
16
15
  //#region src/cli/init.ts
17
16
  const detectPackageManager = () => {
@@ -46,7 +45,7 @@ const initCommand = defineCommand({
46
45
  }
47
46
  },
48
47
  run: withCommonArgs(async (args) => {
49
- const packageJson$1 = await readPackageJSON(import.meta.url);
48
+ const packageJson$1 = await readPackageJson();
50
49
  const version = packageJson$1.version && packageJson$1.version !== "0.0.0" ? packageJson$1.version : "latest";
51
50
  let packageManager = detectPackageManager();
52
51
  if (!packageManager) {
@@ -969,7 +968,7 @@ const workspaceCommand = defineCommand({
969
968
  //#endregion
970
969
  //#region src/cli/index.ts
971
970
  register("tsx", import.meta.url, { data: {} });
972
- const packageJson = await readPackageJSON(import.meta.url);
971
+ const packageJson = await readPackageJson();
973
972
  const mainCommand = defineCommand({
974
973
  meta: {
975
974
  name: packageJson.name,
@@ -1,5 +1,5 @@
1
1
  /// <reference path="./../plugin-generated.d.ts" />
2
2
 
3
- import { AuthConfig, AuthServiceInput, BuiltinIdP, ExecutorServiceConfig, ExecutorServiceInput, IDToken, IdPConfig, IdProviderConfig, OAuth2Client, OAuth2ClientGrantType, OIDC, PermissionCondition, QueryType, Resolver, ResolverServiceConfig, ResolverServiceInput, SAML, SCIMAttribute, SCIMAttributeMapping, SCIMAttributeType, SCIMAuthorization, SCIMConfig, SCIMResource, StaticWebsiteConfig, TailorField, TailorTypeGqlPermission, TailorTypePermission, TailorUser, TenantProviderConfig, UserAttributeKey, UserAttributeListKey, UserAttributeMap, UsernameFieldKey, ValueOperand, db, defineAuth, defineConfig, defineGenerators, defineIdp, defineStaticWebSite, unauthenticatedTailorUser } from "../types-BP7g8Bh3.mjs";
4
- import { FunctionOperation, GqlOperation, IncomingWebhookArgs, IncomingWebhookRequest, IncomingWebhookTrigger, Operation, RecordCreatedArgs, RecordDeletedArgs, RecordTrigger, RecordUpdatedArgs, ResolverExecutedArgs, ResolverExecutedTrigger, ScheduleTrigger, Trigger, WebhookOperation, createExecutor, createResolver, incomingWebhookTrigger, infer, output, recordCreatedTrigger, recordDeletedTrigger, recordUpdatedTrigger, resolverExecutedTrigger, scheduleTrigger, t } from "../index-Bwrm8M8p.mjs";
3
+ import { AuthConfig, AuthServiceInput, BuiltinIdP, ExecutorServiceConfig, ExecutorServiceInput, IDToken, IdPConfig, IdProviderConfig, OAuth2Client, OAuth2ClientGrantType, OIDC, PermissionCondition, QueryType, Resolver, ResolverServiceConfig, ResolverServiceInput, SAML, SCIMAttribute, SCIMAttributeMapping, SCIMAttributeType, SCIMAuthorization, SCIMConfig, SCIMResource, StaticWebsiteConfig, TailorField, TailorTypeGqlPermission, TailorTypePermission, TailorUser, TenantProviderConfig, UserAttributeKey, UserAttributeListKey, UserAttributeMap, UsernameFieldKey, ValueOperand, db, defineAuth, defineConfig, defineGenerators, defineIdp, defineStaticWebSite, unauthenticatedTailorUser } from "../types-CPcmGK_X.mjs";
4
+ import { FunctionOperation, GqlOperation, IncomingWebhookArgs, IncomingWebhookRequest, IncomingWebhookTrigger, Operation, RecordCreatedArgs, RecordDeletedArgs, RecordTrigger, RecordUpdatedArgs, ResolverExecutedArgs, ResolverExecutedTrigger, ScheduleTrigger, Trigger, WebhookOperation, createExecutor, createResolver, incomingWebhookTrigger, infer, output, recordCreatedTrigger, recordDeletedTrigger, recordUpdatedTrigger, resolverExecutedTrigger, scheduleTrigger, t } from "../index-DHpKRtq3.mjs";
5
5
  export { AuthConfig, AuthServiceInput, BuiltinIdP, ExecutorServiceConfig, ExecutorServiceInput, FunctionOperation, GqlOperation, IDToken, IdPConfig, IdProviderConfig, IncomingWebhookArgs, IncomingWebhookRequest, IncomingWebhookTrigger, OAuth2Client, OAuth2ClientGrantType, OIDC, Operation, PermissionCondition, QueryType, RecordCreatedArgs, RecordDeletedArgs, RecordTrigger, RecordUpdatedArgs, Resolver, ResolverExecutedArgs, ResolverExecutedTrigger, ResolverServiceConfig, ResolverServiceInput, SAML, SCIMAttribute, SCIMAttributeMapping, SCIMAttributeType, SCIMAuthorization, SCIMConfig, SCIMResource, ScheduleTrigger, StaticWebsiteConfig, TailorField, TailorTypeGqlPermission, TailorTypePermission, TailorUser, TenantProviderConfig, Trigger, UserAttributeKey, UserAttributeListKey, UserAttributeMap, UsernameFieldKey, ValueOperand, WebhookOperation, createExecutor, createResolver, db, defineAuth, defineConfig, defineGenerators, defineIdp, defineStaticWebSite, incomingWebhookTrigger, infer, output, recordCreatedTrigger, recordDeletedTrigger, recordUpdatedTrigger, resolverExecutedTrigger, scheduleTrigger, t, unauthenticatedTailorUser };
@@ -1,6 +1,6 @@
1
1
  /// <reference path="./plugin-generated.d.ts" />
2
2
 
3
- import { AllowedValues, AllowedValuesOutput, ArrayFieldOutput, ExecutorInput, FieldMetadata, FieldOptions, FieldOutput, FunctionOperation, GqlOperation, IncomingWebhookTrigger as IncomingWebhookTrigger$1, InferFieldsOutput, RecordTrigger as RecordTrigger$1, ResolverExecutedTrigger as ResolverExecutedTrigger$1, ResolverInput, ScheduleTriggerInput, TailorDBType, TailorField, TailorUser, WebhookOperation, output as output$1 } from "./types-BP7g8Bh3.mjs";
3
+ import { AllowedValues, AllowedValuesOutput, ArrayFieldOutput, ExecutorInput, FieldMetadata, FieldOptions, FieldOutput, FunctionOperation, GqlOperation, IncomingWebhookTrigger as IncomingWebhookTrigger$1, InferFieldsOutput, RecordTrigger as RecordTrigger$1, ResolverExecutedTrigger as ResolverExecutedTrigger$1, ResolverInput, ScheduleTriggerInput, TailorDBType, TailorField, TailorUser, WebhookOperation, output as output$1 } from "./types-CPcmGK_X.mjs";
4
4
  import { EmptyObject } from "type-fest";
5
5
  import { Client } from "@urql/core";
6
6
  import { StandardCRON } from "ts-cron-validator";