primitive-admin 1.1.0-alpha.71 → 1.1.0-alpha.73

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 (65) hide show
  1. package/dist/src/commands/apps.js +5 -2
  2. package/dist/src/commands/apps.js.map +1 -1
  3. package/dist/src/commands/database-types.js +13 -313
  4. package/dist/src/commands/database-types.js.map +1 -1
  5. package/dist/src/commands/email-templates.js +3 -3
  6. package/dist/src/commands/email-templates.js.map +1 -1
  7. package/dist/src/commands/env.js +17 -1
  8. package/dist/src/commands/env.js.map +1 -1
  9. package/dist/src/commands/init.d.ts +15 -0
  10. package/dist/src/commands/init.js +158 -22
  11. package/dist/src/commands/init.js.map +1 -1
  12. package/dist/src/commands/integrations.js +30 -14
  13. package/dist/src/commands/integrations.js.map +1 -1
  14. package/dist/src/commands/llm.js +9 -6
  15. package/dist/src/commands/llm.js.map +1 -1
  16. package/dist/src/commands/scripts.d.ts +10 -0
  17. package/dist/src/commands/scripts.js +137 -8
  18. package/dist/src/commands/scripts.js.map +1 -1
  19. package/dist/src/commands/settings.d.ts +18 -0
  20. package/dist/src/commands/settings.js +54 -0
  21. package/dist/src/commands/settings.js.map +1 -0
  22. package/dist/src/commands/sync.d.ts +1 -31
  23. package/dist/src/commands/sync.js +5 -79
  24. package/dist/src/commands/sync.js.map +1 -1
  25. package/dist/src/lib/app-settings-descriptor.js +5 -0
  26. package/dist/src/lib/app-settings-descriptor.js.map +1 -1
  27. package/dist/src/lib/env-resolver-core.d.ts +40 -0
  28. package/dist/src/lib/env-resolver-core.js +60 -0
  29. package/dist/src/lib/env-resolver-core.js.map +1 -1
  30. package/dist/src/lib/generated-config-surfaces.js +19 -0
  31. package/dist/src/lib/generated-config-surfaces.js.map +1 -1
  32. package/dist/src/lib/generated-workflow-model-fields.d.ts +20 -0
  33. package/dist/src/lib/generated-workflow-model-fields.js +53 -0
  34. package/dist/src/lib/generated-workflow-model-fields.js.map +1 -0
  35. package/dist/src/lib/google-client-secret-status.d.ts +35 -0
  36. package/dist/src/lib/google-client-secret-status.js +56 -0
  37. package/dist/src/lib/google-client-secret-status.js.map +1 -0
  38. package/dist/src/lib/init-client-platforms.d.ts +14 -0
  39. package/dist/src/lib/init-client-platforms.js +71 -0
  40. package/dist/src/lib/init-client-platforms.js.map +1 -0
  41. package/dist/src/lib/init-email-redirect-uris.d.ts +37 -0
  42. package/dist/src/lib/init-email-redirect-uris.js +46 -0
  43. package/dist/src/lib/init-email-redirect-uris.js.map +1 -0
  44. package/dist/src/lib/init-ios-links.d.ts +40 -0
  45. package/dist/src/lib/init-ios-links.js +66 -1
  46. package/dist/src/lib/init-ios-links.js.map +1 -1
  47. package/dist/src/lib/integration-selector.d.ts +42 -0
  48. package/dist/src/lib/integration-selector.js +46 -0
  49. package/dist/src/lib/integration-selector.js.map +1 -0
  50. package/dist/src/lib/local-test-cases.d.ts +63 -0
  51. package/dist/src/lib/local-test-cases.js +135 -0
  52. package/dist/src/lib/local-test-cases.js.map +1 -0
  53. package/dist/src/lib/project-config.d.ts +8 -0
  54. package/dist/src/lib/project-config.js +17 -0
  55. package/dist/src/lib/project-config.js.map +1 -1
  56. package/dist/src/lib/test-case-file-names.d.ts +40 -0
  57. package/dist/src/lib/test-case-file-names.js +91 -0
  58. package/dist/src/lib/test-case-file-names.js.map +1 -0
  59. package/dist/src/lib/web-url.d.ts +40 -0
  60. package/dist/src/lib/web-url.js +76 -0
  61. package/dist/src/lib/web-url.js.map +1 -0
  62. package/dist/src/lib/workflow-field-descriptor.d.ts +91 -0
  63. package/dist/src/lib/workflow-field-descriptor.js +153 -0
  64. package/dist/src/lib/workflow-field-descriptor.js.map +1 -0
  65. package/package.json +1 -1
@@ -5,6 +5,7 @@ import { type FieldForm } from "../lib/toml-native-form.js";
5
5
  import { type PushMode } from "../lib/config-payload.js";
6
6
  import { type ConfigObjectSurface, type ConfigTable } from "../lib/generated-config-surfaces.js";
7
7
  import { type PresenceOutcome, type TestBlockType } from "../lib/sync-resource-types.js";
8
+ export { resolveSlugCollisions, slugifyTestCaseName, testCaseFileBasenames, } from "../lib/test-case-file-names.js";
8
9
  import type { SyncState } from "../types/index.js";
9
10
  import { type SyncSelection } from "../lib/sync-selectors.js";
10
11
  /**
@@ -1806,17 +1807,6 @@ export declare function unselectedRuleSetIds(params: {
1806
1807
  /** The `ruleSet.name` a file declares — the name references use. */
1807
1808
  nameForFile: (file: string) => string | undefined;
1808
1809
  }): Map<string, string>;
1809
- export declare function slugifyTestCaseName(name: string): string;
1810
- /**
1811
- * The name to use for `slug`, given the names already taken.
1812
- *
1813
- * `occupy` decides what "already taken" means, and `usedSlugs` holds names in
1814
- * that form (#2896): a file name is occupied CASE-INSENSITIVELY on the
1815
- * filesystems most of these trees live on, so `Foo` and `foo` are one file even
1816
- * though they are two strings. The returned name keeps its own casing — only
1817
- * the occupancy check is normalized.
1818
- */
1819
- export declare function resolveSlugCollisions(slug: string, usedSlugs: Set<string>, occupy?: (name: string) => string): string;
1820
1810
  export declare function getTestsDir(configDir: string, blockType: string, blockKey: string): string;
1821
1811
  export interface TestCaseLookupMaps {
1822
1812
  configIdToName: Map<string, string>;
@@ -2091,25 +2081,6 @@ export declare function pushTestCasesForBlock(params: {
2091
2081
  }): Promise<{
2092
2082
  skipped: number;
2093
2083
  }>;
2094
- /**
2095
- * The file name each live test case belongs in (#2896).
2096
- *
2097
- * A KEYED case is named by its key: that is what the key is — the basename the
2098
- * committed tree carries. An unkeyed one (created by web-admin, an older CLI or
2099
- * the raw API) keeps the slug-of-name naming, with the collision suffixes
2100
- * resolved only AFTER the keys have claimed theirs, so a slug can never take a
2101
- * name a key owns.
2102
- *
2103
- * One function for pull, for pairing's adoption pass and for the diff's
2104
- * remote-only rows, because three commands that name a case's file differently
2105
- * is the disagreement this issue reports.
2106
- *
2107
- * Two names that differ only by CASE are one file on a case-insensitive
2108
- * filesystem, so occupancy is tracked the way the server's key constraint
2109
- * normalizes: a keyed `Foo` and an unkeyed case named "foo" get `Foo.toml` and
2110
- * `foo-2.toml`, rather than one pull silently overwriting the other's sidecar.
2111
- */
2112
- export declare function testCaseFileBasenames(liveCases: any[], onUnusableKey?: (live: any, reason: string) => void, isSafeName?: (name: string) => boolean): Map<any, string>;
2113
2084
  /**
2114
2085
  * Whether a sidecar and a live case say the same thing (#2896).
2115
2086
  *
@@ -2320,4 +2291,3 @@ export declare function applyTestCasePrune(params: {
2320
2291
  * are internal identifiers, deliberately left alone (#2759 scope).
2321
2292
  */
2322
2293
  export declare function registerConfigSyncCommands(sync: Command): void;
2323
- export {};
@@ -35,6 +35,11 @@ import { CONFIG_SURFACES, isEmptyForEmit, } from "../lib/generated-config-surfac
35
35
  import { detectLayout, migrateLegacyToV2 } from "../lib/block-layout.js";
36
36
  import { ABSENT_FROM_EXPORT, LOCAL_ONLY_ABSENT, LOCAL_ONLY_NEW, PUSH_PRUNE_SPECS, REMOTE_ONLY_UNMANAGED, REMOTE_ONLY_WILL_DELETE, SYNC_RESOURCE_TYPES, VALIDATION_ERROR, applyPrune, attachmentWritePath, attemptFetch, classifyLocalOnly, classifyPruneDeleteFailure, classifyRemoteOnly, collectPushPruneCandidates, decidePushPruneCandidate, formatPrunePlan, hasUncommittedChanges, isSafeAttachmentFilename, isSafeSyncFilename, planPrune, preserveUnwrittenEntries, removePrunedSidecar, ruleSetFileKey, } from "../lib/sync-resource-types.js";
37
37
  import { normalizeTestCaseKey, testCaseKeyError, } from "../lib/test-case-keys.js";
38
+ import { slugifyTestCaseName, testCaseFileBasenames, } from "../lib/test-case-file-names.js";
39
+ // The sidecar naming rules moved to `lib/` so `scripts tests` can read them
40
+ // without loading the sync tree (#3061); re-exported here because pull, push,
41
+ // diff and their tests have always imported them from this module.
42
+ export { resolveSlugCollisions, slugifyTestCaseName, testCaseFileBasenames, } from "../lib/test-case-file-names.js";
38
43
  import { success, error, printApiError, info, warn, keyValue, json, divider, } from "../lib/output.js";
39
44
  import { filterFilesBySelection, parseSyncSelectors, SelectorError, selectionIncludesKey, selectionIncludesType, selectionIncludesApp, selectionIncludesAnyVar, unmatchedSelectors, } from "../lib/sync-selectors.js";
40
45
  import { confirmPrompt, ConfirmPromptError } from "../lib/confirm-prompt.js";
@@ -4335,37 +4340,6 @@ export function unselectedRuleSetIds(params) {
4335
4340
  }
4336
4341
  return seeded;
4337
4342
  }
4338
- // Test case helpers (exported for unit testing)
4339
- export function slugifyTestCaseName(name) {
4340
- return name
4341
- .toLowerCase()
4342
- .replace(/[^a-z0-9]+/g, "-")
4343
- .replace(/^-+|-+$/g, "")
4344
- || "test";
4345
- }
4346
- /**
4347
- * The name to use for `slug`, given the names already taken.
4348
- *
4349
- * `occupy` decides what "already taken" means, and `usedSlugs` holds names in
4350
- * that form (#2896): a file name is occupied CASE-INSENSITIVELY on the
4351
- * filesystems most of these trees live on, so `Foo` and `foo` are one file even
4352
- * though they are two strings. The returned name keeps its own casing — only
4353
- * the occupancy check is normalized.
4354
- */
4355
- export function resolveSlugCollisions(slug, usedSlugs, occupy = (name) => name) {
4356
- const taken = (candidate) => usedSlugs.has(occupy(candidate));
4357
- if (!taken(slug)) {
4358
- usedSlugs.add(occupy(slug));
4359
- return slug;
4360
- }
4361
- let counter = 2;
4362
- while (taken(`${slug}-${counter}`)) {
4363
- counter++;
4364
- }
4365
- const resolved = `${slug}-${counter}`;
4366
- usedSlugs.add(occupy(resolved));
4367
- return resolved;
4368
- }
4369
4343
  export function getTestsDir(configDir, blockType, blockKey) {
4370
4344
  // Scripts (blockType "script") live under `transforms/` on disk (their
4371
4345
  // bodies are `transforms/<name>.rhai`), so their test cases sit alongside at
@@ -5478,54 +5452,6 @@ export async function pushTestCasesForBlock(params) {
5478
5452
  }
5479
5453
  return { skipped };
5480
5454
  }
5481
- /**
5482
- * The file name each live test case belongs in (#2896).
5483
- *
5484
- * A KEYED case is named by its key: that is what the key is — the basename the
5485
- * committed tree carries. An unkeyed one (created by web-admin, an older CLI or
5486
- * the raw API) keeps the slug-of-name naming, with the collision suffixes
5487
- * resolved only AFTER the keys have claimed theirs, so a slug can never take a
5488
- * name a key owns.
5489
- *
5490
- * One function for pull, for pairing's adoption pass and for the diff's
5491
- * remote-only rows, because three commands that name a case's file differently
5492
- * is the disagreement this issue reports.
5493
- *
5494
- * Two names that differ only by CASE are one file on a case-insensitive
5495
- * filesystem, so occupancy is tracked the way the server's key constraint
5496
- * normalizes: a keyed `Foo` and an unkeyed case named "foo" get `Foo.toml` and
5497
- * `foo-2.toml`, rather than one pull silently overwriting the other's sidecar.
5498
- */
5499
- export function testCaseFileBasenames(liveCases, onUnusableKey, isSafeName) {
5500
- const used = new Set();
5501
- const occupy = (name) => normalizeTestCaseKey(name);
5502
- const names = new Map();
5503
- const unkeyed = [];
5504
- for (const live of liveCases) {
5505
- const key = typeof live?.key === "string" ? live.key : "";
5506
- if (!key) {
5507
- unkeyed.push(live);
5508
- continue;
5509
- }
5510
- // The key is SERVER data on its way to becoming a path. A server that
5511
- // stored one this CLI would not have sent must not be able to name a file
5512
- // outside the sidecar directory.
5513
- const reason = testCaseKeyError(key) ??
5514
- (isSafeName && !isSafeName(key)
5515
- ? `test case key "${key}" is not a safe file name here`
5516
- : null);
5517
- if (reason) {
5518
- onUnusableKey?.(live, reason);
5519
- unkeyed.push(live);
5520
- continue;
5521
- }
5522
- names.set(live, resolveSlugCollisions(key, used, occupy));
5523
- }
5524
- for (const live of unkeyed) {
5525
- names.set(live, resolveSlugCollisions(slugifyTestCaseName(live?.name || "unnamed"), used, occupy));
5526
- }
5527
- return names;
5528
- }
5529
5455
  /**
5530
5456
  * Whether a sidecar and a live case say the same thing (#2896).
5531
5457
  *